Listen for Events from Browser "Find" Window in JavaScript - Stack Overflow

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

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


(source: apple)

I'd like to be able to reinterpret the search text from JavaScript. What do I need to add an event listener for?

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


(source: apple.)

I'd like to be able to reinterpret the search text from JavaScript. What do I need to add an event listener for?

Share Improve this question edited Mar 30, 2021 at 19:17 Glorfindel 22.7k13 gold badges90 silver badges119 bronze badges asked Nov 25, 2009 at 0:11 Lance PollardLance Pollard 79.6k98 gold badges333 silver badges610 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 5

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.

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...

No. There is no web standard that defines a "find" dialog, let alone events for it. The find dialog is vendor-specific and for all you know, browser X's "find" dialog lets users enter a mathematical function and match/"find" pixels on the page with it.

Hardly. Even if it were possible through some loophole to listen to the browser's built-in "find" function, it would be a privacy issue and get closed sooner or later. I'm quite sure you won't be able to listen to the keystrokes either, as they take place outside the page's focus.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745106272a4611573.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信