Listen to chrome omnibox events/text without any keyword triggering

我与影子孤独终老i 提交于 2019-12-02 02:48:15

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/27615253/listen-to-chrome-omnibox-events-text-without-any-keyword-triggering

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!