从浏览器中收听事件“查找” JavaScript中的窗口 [英] Listen for Events from Browser "Find" Window in JavaScript

查看:94
本文介绍了从浏览器中收听事件“查找” JavaScript中的窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在 JavaScript 中浏览浏览器的查找窗口进行输入?

Is there a way to listen for typing into the browser's "find" window in JavaScript?

此窗口http: //images.apple.com/safari/images/find20070611.png

我想能够重新诠释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模拟find-toolbar /窗口。然而,由于某些浏览器根据本地化来定制键盘快捷键,这是一个可怕的(几乎不可能的)任务(例如,在IE中,en-US使用Ctrl + F(for Find ),而pt -PT使用Ctrl + L(对于 Localizar ,意思是find))。

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中的窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆