XUL and JavaScript question
Hi. I'm writing an extension for Mozilla Firefox, I want it to show the URL that is lodaded. The problem is that when I use this property
window.location.href
it shows "chrome://browser/content/browser.xul"
How can I access the URL that is loaded? thanks!
# 3 Re: XUL and JavaScript question
Ok, here is the solution, just using the content.document.location
URLActual = content.document.location; // Global variable
//This function is executed when another toolbar button is pressed
function Activar()
{
var boton2 = null; // Old and rusty programmer habit
var boton2 = document.getElementById("myextension-button2");
// That's the button in firefox's toolbar, where I want to show the current URL
URLActual = content.document.location;
if (boton2.disabled==false)
boton2.disabled = true; //I enable the button if disabled
else
boton2.disabled = false;
boton2.label = URLActual; // And I change the label
}
Now, what I would like to do is to refresh the global variable "URLActual" every time the url changes, I'm fighting with that right now...