Tiny Javascript library for handling browser window.location.hash with backward compatibility for old browsers
-include the zHash.js file in your HTML head. (or add it to your existing JS file)
-use the listen function to assign a JS function when the desired hash is selected: zHash.listen('myhash', someFunction(){ });
-you can assign a parameter to a hash like this: zHash.listen('myhash/$', someFunction(myParam){ }); . the "/$" is processed as a parameter in the hash string. zHash accepts multiple parameters as well: zHash.listen('myhash/$/$', someFunction(a, b){ }); . Example of a hash with parameters: http://example.com/index.html#comments/123/741
-after you finish assigning functions to hashes, execute this function to start monitoring hashes: zHash.start( 'defaultHash' );
the 'defaultHash' is optional, it selects the defaultHash if window.location.hash was empty
Yes, it works even on bloody IE !
zHash is pure Javascript, so it doesn't require jQuery or any library. Works side by side perfectly tho.