简体   繁体   中英

window.location.href not setting query parameters

I'm trying to set a new url, I've used:

window.location.href = <url>;
window.location.assign(<url>);

if the url contains a section with query string parameters, Eg. info?value=1 in IE the url will not show these parameters. I tried the above two in Chrome and Chrome does show the query parameters. What's the hack to get it to work in IE?

location.assign(encodeURIComponent('/step2.php?id=1'));

The problem is likely due to the value of your variables. If they contain special or invalid characters, those needs to be passed through encodeURIComponent before being assigned location.assign

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM