简体   繁体   中英

window .open is not opening on page load in ie8

您好无法打开window.open在ie8中加载页面如果我使用window.location它没有在新页面中打开,请帮助我。

This is because you're running into the popup blocker. This is a Good Thing (tm) :-) You can only open popups in response to the user taking an explicit action, like clicking something (and then typically only from within the event handler itself), not on things like page load where the unwitting user could be (and historically has been) inundated with dozens of windows opening all over the place. (And even doing it in response to an explicit user action may not be allowed by some blockers.)

Are no-one seeing a big problem with running window.open(window.location.href,'_blank') in the onload handler?

This is systematically a recursive function which would continue until the user manages to close the new window prior to the onload handler running.

I'm not saying that this has anything to do with the problem it might just be that IE8 is clever enough to see this..

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