views:

23

answers:

1

I'm developing an extension that requires to set focus to the address bar at some point. I've been trying to RTFM, but the FM is so hard to read!

Does anyone know of any way to set focus to the address bar from within a firefox extension?

TIA.

+2  A: 

I would imagine it would be something like:

var addressBar=document.getElementById('urlbar');
addressBar.focus();

assuming document is in the XUL Chrome context.

I haven't tested that yet though, so I'm not 100% yet.

lucideer
Thanks, lucideer. Any idea where I can find the documentation for such elements on the chrome? Thanks again.
Rakesh Pai
Just use the DOMInspector extension - it lets you browse the XUL chrome DOM.
lucideer
A simple but very handy time-saver when using DOM Inspector is https://addons.mozilla.org/en-US/firefox/addon/3276/ -- the install.rdf says it's not compatible with 3.6.6 but it actually works fine, as far as I can tell.
MatrixFrog
You can also just load chrome://browser/content/browser.xul in FF and use Firebug to inspect the DOM. Though it's funny to see the browser in the browser.
jeffamaphone