简体   繁体   中英

IE11 gives a “SCRIPT70: Permission denied” error when using window.location to reload the page

I have a page that has filters, when a filter is selected, the page is re-loaded using window.location with an altered querystring.

This is working in Firefox, Chrome, Opera, Edge, but in IE11 I get a "SCRIPT70: Permission denied" error and a blank page.

However, this doesn't happen every time - it's intermittent!

This isn't an iFrame or cross-domain script issue - the page is reloading itself.

The code is simple - the onclick event calls a function, the function changes the querystring & then does:

window.location = "/search_results?" + qs;

Where qs is the updated querystring. That's it.

I have tried using the full URL (inc domain name) - no difference. I have tried changing to window.location.href - no difference.

Has anyone seen this before?

Thanks

尝试使用document.location而不是window.location

location is an object.

location.href = "address";

or

location.assign("address");

can help.

https://www.w3schools.com/jsref/met_loc_assign.asp

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