[Project_owners] get URL as shown in addressbar

Arturo 'Buanzo' Busleiman buanzo at buanzo.com.ar
Mon Jun 18 15:45:31 PDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Hi Guys!

I need to run some code after a site has finished loading. I know about using this:

if (document.getElementById("appcontent"))
document.getElementById("appcontent").addEventListener("DOMContentLoaded", function(e) {
qogame.onPageLoad(e); }, true);

and then:

onPageLoad: function(aEvent) {
                var doc = aEvent.originalTarget;
                var url = doc.location.href;
                if (aEvent.originalTarget.nodeName == "#document") { // ok, it's a real page

But that does not suit me, because that would trigger many calls to onPageLoad for one single "site".

So, when I type, for example, "www.google.com" on my address bar, and press enter, I might get
redirected, then images and other files (css, js) will be loaded, etc, but in the end what I see is
"www.google.com.ar" (for example, because google.com redirects based on ip-to-country).

So, how can I get that "http://www.google.com.ar", and feed it to my function?

For example, If I click on a statusbar I've added to my chrome://browser overlay, I can get that
value using:

content.document.location, etc.

Any ideas?

- --
Arturo "Buanzo" Busleiman - Consultor Independiente en Seguridad Informatica
Free Music: http://www.buanzo.com.ar/files/buanzo-ultimamente.ogg
Consulting and Secure Mail Hosting: http://www.buanzo.com.ar/pro/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGdwsDAlpOsGhXcE0RChV+AJ0WRF39nGcc5LVIf0yKFpDv7rriTgCfbnqw
sFBqD1DBi2KPRUGMyNaqDek=
=rIP8
-----END PGP SIGNATURE-----


More information about the Project_owners mailing list