Last active
August 29, 2015 14:15
-
-
Save alvaropinot/43a13c1ca697aaedfd85 to your computer and use it in GitHub Desktop.
simple url arguments reader
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
//remove the starting '?' and split options | |
location.search.slice(1).split("&").forEach(function(opt) { | |
opt = opt.split('='); | |
console.log(opt); // ['arg1','val1'] ['arg2','val2'] | |
}); |
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
var query = window.location.search.substring(1); | |
if (!query) { | |
var hash = window.location.hash; | |
query = hash.slice(hash.indexOf('?') + 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://stackoverflow.com/questions/5659957/window-location-search-substring-is-not-working-in-ie-8