I need it to use in my firefox extension. I already tried window.onload event listener, and check if current url == old url, and it's a good idea, but it does'nt work when page loads pdf.
I saw hash changed function too but it works only with ff 3.6; i need it to work at least with ff 3.
So, i need an event listener that check if document.location changes.
Thanks
For example, you could use:
But, the point is, you need to add the listener to the browser, not window.
EDIT
See https://developer.mozilla.org/En/Code_snippets/Tabbed_browser for info on accessing the browser from different contexts, as well as some other useful info.
EDIT
Just to add a little more detail....
Note that this will respond to pages opened in any tab, not a specific tab.
For a specific tab, you could use something like this:
The above adds a new tab and then adds a listener. However, for all tabs, you'll need something like the following. And then add the "DOMContentLoaded" event listener on each tab when added (and removed when closed).
You may also want to see: https://developer.mozilla.org/En/Code_snippets/Tabbed_browser#Notification_when_a_tab_is_added_or_removed and https://developer.mozilla.org/En/Code_snippets/Tabbed_browser#Getting_document_of_currently_selected_tab
(For preservation)
This should get you 99% of the way there.
Add a Progress Listener and monitor location changes inside tab. Cover tab swithches with Addon SDK.
To install a listener, convert SDK tab to its raw (old) representation using viewFor. Backward conversion is possible with modelFor and getTabForContentWindow.
Inspired by Converting to chrome windows