There is no event for a location change (there is for hash change though, see "hashchange"), so you would have to use polling to keep track of the location by checking in intervals.
You could track clicks on anchors inside your page and prevent the default behaviour occuring (i.e. the browser loading the new page and possibly halt executing the remaining JavaScript in the event handler) so you can delay the page change and execute whatever logic your application requires before the document is unloaded (which would fire an unload event).
Which brings me to the question : what do you intend to do ?