Skip to content

Instantly share code, notes, and snippets.

@ruan4261
Last active May 25, 2021
Embed
What would you like to do?
function getUrlParams() {
var query = location.search// from ? to #
var params = {}
if (query.length > 1) {
var queryStr = query.substr(1)
var entry = queryStr.split('&')
for (var i = 0; i < entry.length; i++) {
var kv = entry[i].split('=')
var key = kv[0]
var value = kv[1]// maybe undefined
params[kv] = value
}
}
return params
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment