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