This article mainly introduces how to obtain the parameters from the page through window.location.search. It has been tested and is OK
function GetQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)","i"); var r = window.location.search.substr(1).match(reg); if (r!=null) return (r[2]); return null; }
var sname = GetQueryString("name"); if(sname!=null) { var sname_ = decodeURIComponent(sname); alert(sname_); }
Test
abcd.html?name=xyz
xyz should pop up