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 doesn’t work when page loads PDF.
I saw hash changed function too but it works only with Firefox 3.6; I need it to work at least with Firefox 3.
So, I need an event listener that check if document.location changes.
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.