jQuery - hashchange event
You can detect if the browser supports the event by:
if ("onhashchange" in window) { //...}
See also:
An updated answer here as of 2017, should anyone need it, is that onhashchange
is well supported in all major browsers. See caniuse for details. To use it with jQuery no plugin is needed:
$( window ).on( 'hashchange', function( e ) { console.log( 'hash changed' );} );
Occasionally I come across legacy systems where hashbang URL's are still used and this is helpful. If you're building something new and using hash links I highly suggest you consider using the HTML5 pushState API instead.
There is a hashchange plug-in which wraps up the functionality and cross browser issues available here.