I'm writing a Firefox add-on and trying to get what is currently typed into the address bar, but every time I try, I get a null error. The code I'm using is
var url = document.getElementById("urlbar").value;
However, when I do that, the error I get is
Error on line 1: document.getElementById("urlbar") is null`.
I have a blank tab open with text written into the address bar. This is in firefox 3.6.9 .
Any help would be appreciated. Thanks!
Edit: If there is no way to get the contenets of the url bar, before the user presses enter, is it possible to "intercept" what they typed after they press enter?