Listen for Events from Browser quot;Findquot; Window in JavaScript(监听来自浏览器“查找的事件JavaScript 中的窗口)
问题描述
有没有办法监听输入浏览器的查找"?JavaScript 中的窗口?
Is there a way to listen for typing into the browser's "find" window in JavaScript?
(来源:apple.com)
我希望能够从 JavaScript 重新解释搜索文本.我需要为什么添加事件侦听器?
I'd like to be able to reinterpret the search text from JavaScript. What do I need to add an event listener for?
推荐答案
我不知道有什么方法可以监听类似 find 的事件,如果任何浏览器都支持它肯定不是便携式解决方案.
I don't know of any way you can listen for a find-like event and if that's supported in any browser it sure isn't a portable solution.
我也不知道您要实现什么,但我认为您最好的选择是侦听触发查找窗口的键盘事件并在尝试模拟查找工具栏/窗口时尝试取消它们使用您自己的 JavaScript.然而,这是一项艰巨(几乎不可能)的任务,因为某些浏览器根据本地化自定义键盘快捷键(例如,在 IE 中,en-US 使用 Ctrl+F(用于 Find)而 pt-PT 使用 Ctrl+L(对于 Localizar,意思是查找).
I also don't know what you're trying to achieve but I think that your best option is to listen for the keyboard events that trigger the find window and attempt to cancel them while attempting to emulate the find-toolbar/window with JavaScript of your own. This is however a herculean (and nearly impossible) task due to some browsers customization of keyboard shortcuts depending on the localization (for instance, in IE, en-US uses Ctrl+F (for Find) while pt-PT uses Ctrl+L (for Localizar, meaning find)).
结论:我认为你不走运......
Conclusion: I think you're out of luck there...
这篇关于监听来自浏览器“查找"的事件JavaScript 中的窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:监听来自浏览器“查找"的事件JavaScript 中的窗口


基础教程推荐
- 自定义 XMLHttpRequest.prototype.open 2022-01-01
- Vue 3 – <过渡>渲染不能动画的非元素根节点 2022-01-01
- 如何使用JIT在顺风css中使用布局变体? 2022-01-01
- Chart.js 在线性图表上拖动点 2022-01-01
- Electron 将 Node.js 和 Chromium 上下文结合起来意味着 2022-01-01
- 我可以在浏览器中与Babel一起使用ES模块,而不捆绑我的代码吗? 2022-01-01
- 如何使用TypeScrip将固定承诺数组中的项设置为可选 2022-01-01
- html表格如何通过更改悬停边框来突出显示列? 2022-01-01
- 直接将值设置为滑块 2022-01-01
- 用于 Twitter 小部件宽度的 HTML/CSS 2022-01-01