在没有任何关键字触发的情况下收听Chrome多功能框事件/文字 [英] Listen to chrome omnibox events/text without any keyword triggering

查看:96
本文介绍了在没有任何关键字触发的情况下收听Chrome多功能框事件/文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我学会了如何通过在多功能框中输入特定关键字来调用我的扩展程序的背景js。但是我需要启用我的扩展才能在没有任何关键字的帮助下监听在多功能框中输入的文本。


$ b 示例:如果用户键入abc或abcd或abcd。 com,我的扩展应该被触发。在这里我不能依赖任何关键字,因为用户会直接输入目标网站名称。



当我尝试使用关键字作为可能的目标名称(比如说abcd.com)触发不起作用,因为用户键入abc时,chrome autosuggests abcd.com和用户直接选择它,关键字触发不起作用。



我google搜索了,但我找到的所有教程围绕使用关键字。我想要一个类似于eventlistener的东西,它会一直监听每个标签的多功能框。



任何教程或源代码对我都很有帮助。

解决方案

这是不可能的。 API不允许你在Omnibox上窥探。



这就是关键字的要点 - 只有在你输入了关键字后, p>

I learnt how to invoke my extension's background js by typing a specific keyword in the omnibox. But I need to enable my extension to listen to the text typed in the omnibox without the help of any keyword.

Example: If user types, abc or abcd or abcd.com, my extension should get triggered. Here I cant rely on any keyword, cause user would directly type the target site name.

When I tried using the keyword as the possible target name (say abcd.com) the triggering doesnt work since the moment user types abc, chrome autosuggests abcd.com and user selects it directly and keyword triggering doesnt work.

I googled but all the tutorials I found were around using keywords. I want something like an eventlistener which would listen to every tab's omnibox all the time.

Any tutorials, or sources would be great help to me.

解决方案

This is impossible. The API does not allow you to "spy" on the Omnibox.

That's the point of the keyword - only after you've typed it the extension is informed.

这篇关于在没有任何关键字触发的情况下收听Chrome多功能框事件/文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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