Skip to content

Instantly share code, notes, and snippets.

@rocktronica
Created May 10, 2012 02:30
Show Gist options
  • Save rocktronica/2650604 to your computer and use it in GitHub Desktop.
Save rocktronica/2650604 to your computer and use it in GitHub Desktop.
URL Param Cleanup
data:text/html, <pre id="pre"></pre> <script> document.getElementById("pre").innerHTML = JSON.stringify( (function(s){ var s = (!!s.match(/\?/)) ? s.substr(s.indexOf("?")+1) : s; var qs = s.split("+").join(" "), params = {}, tokens, re = /[?&]?([^=]+)=([^&]*)/g; while (tokens = re.exec(qs)) { params[decodeURIComponent(tokens[1])] = decodeURIComponent(tokens[2]); } return params; } (prompt("?=?"))), null, 4 ); </script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment