function urlArgs (url){ var args = {} var params = location.search.substring(1).split('&') console.log(params) for (let i = 0; i < params.length; i++) { var pos = params[i].indexOf('=') if (pos === -1) continue var name = params[i].substring(0, pos) var value = decodeURIComponent(params[i].substring(pos+1)) args[name] = value } console.log(args) return args }