In modern browsers(IE8+, FF3.6+, Chrome), you can just listen to the
hashchange event on
In some old browsers, you need a timer that continually checks
location.hash. If you're using jQuery, there is a plugin that does exactly that.