// 获取浏览器参数
function getRequest() {
//获取url中"?"符后的字串
const url = location.href
const theRequest = {}
const urlIndex = url.lastIndexOf('?')
if ( urlIndex !== -1 ) {
const str = url.substr(urlIndex + 1)
const strs = str.split('&')
for(let i = 0; i < strs.length; i++) {
theRequest[strs[i].split('=')[0]] = unescape(strs[i].split('=')[1])
}
}
return theRequest
}
网友评论