Skip to content

Instantly share code, notes, and snippets.

@paulhhowells
Last active December 16, 2015 11:49
Show Gist options
  • Select an option

  • Save paulhhowells/5430274 to your computer and use it in GitHub Desktop.

Select an option

Save paulhhowells/5430274 to your computer and use it in GitHub Desktop.
get hash and query string from url
phh = phh || {};
(function ($) {
$(function () {
phh.url.init();
});
phh.url = (function () {
// v 1.3
// runs before dom ready or window loaded
// makes available:
// phh.url.hash
// phh.url.query
return {
hash : decodeURI(location.hash.substring(1)), // substring(1) removes first ? character
query : decodeURI(location.search.substring(1))
};
}());
}(jQuery));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment