views:

226

answers:

3

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.

A: 

I believe this is impossible. It may be doable in a extension.

Matthew Flaschen
This is an extension.
Cyclone
+3  A: 

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.

Jared Forsyth
Thank you! Unfortunate, but now I know it cannot be done.
Cyclone
The omnibar extension support is planned, but no timeframe yet.
Mohamed Mansour
A: 

Nope ... won't work ...

O.

Oliver