你如何让 window.open 在 Internet Explorer 7 中工作?

在过去的 3 个小时里,我一直在尝试让我的 svg 网站打开弹出窗口,但我得到的只是 Internet Explorer 中的权限被拒绝"错误.我已经尝试了所有可以在谷歌上找到的东西,但没有任何效果.我什至已经到了只调用没有参数的 window.open() 空白的地步,仍然得到一个权限被拒绝的错误.目前在 Internet Explorer 中打开弹出式窗口的公认标准是什么...有效?

I've been trying for the past 3 hours to get my svg web site to open popups, and all I ever get is "Permission Denied" errors in internet explorer. I've tried everything I could find on google, and nothing works. I've even gone to the point of just calling window.open() blank with no parameters, and still get a permission denied error. What is the currently accepted standard for opening popups in internet explorer... that works?

推荐答案

这是在 IE6 中所做的安全更改的一部分.现在您只能从用户发起的事件中调用window.open".例如,您的代码将在元素的 onclick 事件中运行."window.open" MSDN 页面 说这个:

This is part of the security changes made in IE6. Now you can only call "window.open" from within a user-initiated event. For example, your code would work inside an element's onclick event. The "window.open" MSDN page says this:

"此方法必须使用用户启动的操作,例如单击链接或跳到一个链接并按下回车键,打开一个弹出窗口.弹出窗口Internet Explorer 6 中的阻止程序功能阻止没有打开的窗口由用户发起."

"This method must use a user-initiated action, such as clicking on a link or tabbing to a link and pressing enter, to open a pop-up window. The Pop-up Blocker feature in Internet Explorer 6 blocks windows that are opened without being initiated by the user."

相关文章