Created
December 1, 2016 10:47
-
-
Save sauntimo/41d5e35d569074a30cf6169d9d51bd1e to your computer and use it in GitHub Desktop.
Get key-value object of URL params in JS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log( JSON.parse('{"' + decodeURI(window.location.href.replace(/^(.*\?)/, '').replace(/&/g, "\",\"").replace(/=/g,"\":\"")) + '"}') ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment