html 添加按钮或链接时点击它触发(F3)Ctrl+F在页面中[关闭]

kqlmhetl  于 8个月前  发布在  其他
关注(0)|答案(1)|浏览(89)

已关闭,此问题需要details or clarity。它目前不接受回答。
**想改善这个问题吗?**通过editing this post添加详细信息并澄清问题。

6天前关闭
Improve this question
我已经创建了一个网页,我想添加一个搜索栏从Chrome浏览器时,有人按下按钮或链接。Chrome搜索栏自动出现(F3)。

00jrzges

00jrzges1#

如果你只想触发事件,你可以试试这个:

const event = new KeyboardEvent('keydown', {
    key: 'F3',
  })
  document.dispatchEvent(event)

但这不能调用Chrome搜索栏,因为一般情况下,网页不能调用浏览器控件。
有关详细信息,请参阅Use Browser Search (Ctrl+F) through a button in website?

相关问题