Q:

firefox extension run on each page

I am new to firefox extension development.  I am building an extension which needs to run for each page the user browses.  At the moment the extension runs when firefox window starts. 
I have pasted code below. 
XUL Code:
<? xml version="1.0"? >
<? xml-stylesheet href="chrome://global/skin/" type="text/css"? >
<window id="mainWin" title="my extension" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript" src="chrome://myextension/content/myextension.js" />
</window>

and in the myextension.js Javascript file I have an alert(window.location.href);
I want to run this extension and get the url of the page I am browsing each time. 
I might be going in a wrong direction.  Any help much appreciated. 

A:

Simpler: https://developer.mozilla.org/en/Code_snippets/On_page_load
More control: https://developer.mozilla.org/en/Code_snippets/Progress_Listeners
Both linked from https://developer.mozilla.org/en/Code_snippets, also see
https://developer.mozilla.org/en/Extensions and https://developer.mozilla.org/en/Extensions/Firefox.