Skip to content

Instantly share code, notes, and snippets.

@mfr
Created October 10, 2011 12:35
Show Gist options
  • Save mfr/1275196 to your computer and use it in GitHub Desktop.
Save mfr/1275196 to your computer and use it in GitHub Desktop.
url parameters - javascript
var urlParams = {};
(function () {
var e,
r = /([^&=]+)=?([^&]*)/g,
d = function (s) { return decodeURIComponent(unescape(s)); },
q = window.location.search.substring(1);
while (e = r.exec(q))
urlParams[d(e[1])] = d(e[2]);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment