Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
jQuery plugin, that allows bind custom handlers that react on url hashes changes.
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.

jquery.hashwatcher.js - jQuery plugin

jquery.hashwatcher.js allow bind custom handlers that will fired on changing key hashes in user browser address bar.

jquery.hashwatcher.js depends on jquery-hashchange. So, be sure insert it before inside the head section on html page.

There are watch and neglect methods.


Watch some certain hash key. It is possible bind more than one handlers to the same hash key.

Handler allows invoke callbacks when hash key appearing in url, disappearing and when its value changed.


$(window).hashwatcher('watch', {
    hashKey: 'status',
    onAppear: function(hashValue) {
        console.log('hashKey' + ' hashKey has appeared.');
        console.log('It has value "' + hashValue + '"');
    onDisappear: function(hashValue) {
        console.log('hashKey' + ' hashKey has disappeared.');
        console.log('Its value was "' + hashValue + '"');
    onChange: function(newHashValue, oldHashValue) {
        console.log('hashKey' + ' hashKey has changed.');
        console.log('Its old value was "' + oldHashValue + '" and new one is "' + newHashValue + '"');


Gets an hash key value. Will return something valuable only of value is set. To check existence of hash key in url, despite of its value, try method exists.

Bind two handler to the same hash key and unbind first of them by handler uid.

example 1:

var hUid1 = $(window).hashwatcher('watch', {hashKey:'status', ...});
var hUid2 = $(window).hashwatcher('watch', {hashKey:'status', ...});
$(window).hashwatcher('neglect', 'status', hUid1);

This piece of code will unbind all the existing handlers for 'status' hash key.

example 2:

$(window).hashwatcher('neglect', 'status');

jQuery versions compatable


Browsers compatable

MS Internet Explorer 6-9, Firefox 2-5, Chrome 5-12, Safari 3.2-5, Opera 9.6-11.50, iPhone 3.1, Android 1.6-2.2, BlackBerry 4.6-5.


Licensed under the MIT license.


Something went wrong with that request. Please try again.