监听来自浏览器“查找"的事件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...
相关文章