监听来自浏览器“查找"的事件JavaScript 中的窗口

Listen for Events from Browser quot;Findquot; Window in JavaScript(监听来自浏览器“查找的事件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 中的窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Update another component when Formik form changes(当Formik表单更改时更新另一个组件)
Formik validation isSubmitting / isValidating not getting set to true(Formik验证正在提交/isValiating未设置为True)
React Validation Max Range Using Formik(使用Formik的Reaction验证最大范围)
Validation using Yup to check string or number length(使用YUP检查字符串或数字长度的验证)
Updating initialValues prop on Formik Form does not update input value(更新Formik表单上的初始值属性不会更新输入值)
password validation with yup and formik(使用YUP和Formick进行密码验证)