从谷歌浏览器的地址栏中获取文本(不是网址) [英] Get text (not url) from address bar in Google Chrome
问题描述
我想使用Javascript检索用户输入到当前可见地址栏中的文本。这只适用于谷歌浏览器。
这可能吗?我知道你可以通过 window.location.href
获取文档URL,但是我无法在地址栏/ omnibar中找到与当前代码有关的任何javascript。
感谢您的帮助!
编辑:这是一个扩展。
<即使有扩展,这也是不可能的 - 至少在谷歌浏览器中。
在当前的扩展平台下对于Chromium来说,插件只是略微提升了一些特权的JavaScript程序;作为扩展开发人员,我对这种情况非常不满,并期待着它的(不可避免的)变化和增长。
不幸的是,您的问题等问题完全不可能。
I want to retrieve the text that the user has typed into the currently visible address bar, using Javascript. This is for google chrome only.
Is this possible? I know you can get the document URL via window.location.href
, but I am unable to locate any javascript pertaining to current code inside the address bar/omnibar.
Thank you for the help!
EDIT: This is for an extension.
Even with extensions this is impossible -- at least in google chrome.
Under the current extensions platform for Chromium, addons are little more than javascript programs with minorly elevated privileges; the nearest correspondence would be the Greasemonkey scripts so popular in Firefox.
As an extension developer, I am very unhappy with this situation, and am looking forward to its (inevitable) change and growth.
For the moment, unfortunately, such things as your question are completely impossible.
这篇关于从谷歌浏览器的地址栏中获取文本(不是网址)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!