Javascript window.open is blocked by IE popup blocker(Javascript window.open 被 IE 弹出窗口阻止程序阻止)
问题描述
Can anyone help, I have a popup that is being blocked. It is a popup that is created because somebody has clicked on a Print picture on my site.
I thought IE is not supposed to block these when the popup came via an onclick
?
Can anyone help? The child1
variable is always returned as NULL
if popup blocker enabled...
Maybe the problem is that the onclick
event then passes control to a new function which loads a html file and does child.document.write
Here is my simple code..
var width = 800;
var height = 600;
var left = parseInt((screen.availWidth / 2) - (width / 2));
var top = parseInt((screen.availHeight / 2) - (height / 2));
var windowFeatures = "width=" + width + ",height=" + height
+ ",menubar=yes,toolbar=yes,scrollbars=yes,resizable=yes,left="
+ left + ",top=" + top + "screenX=" + left + ",screenY=" + top;
child1 = window.open("about:blank", "subWind", windowFeatures);
The problem will be that open will only return a reference to the window if you are navigating to somewhere within your current host. You are navigating to about:blank which is not within your host.
Try adding a blank.htm file to your site and open that instead. I'm still not sure that document.write will be allowed the document won't be open for write, you may be able to manipulate the DOM of the existing blank document though.
这篇关于Javascript window.open 被 IE 弹出窗口阻止程序阻止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Javascript window.open 被 IE 弹出窗口阻止程序阻止


基础教程推荐
- 我可以在浏览器中与Babel一起使用ES模块,而不捆绑我的代码吗? 2022-01-01
- Vue 3 – <过渡>渲染不能动画的非元素根节点 2022-01-01
- 自定义 XMLHttpRequest.prototype.open 2022-01-01
- Electron 将 Node.js 和 Chromium 上下文结合起来意味着 2022-01-01
- Chart.js 在线性图表上拖动点 2022-01-01
- 如何使用TypeScrip将固定承诺数组中的项设置为可选 2022-01-01
- 直接将值设置为滑块 2022-01-01
- 用于 Twitter 小部件宽度的 HTML/CSS 2022-01-01
- 如何使用JIT在顺风css中使用布局变体? 2022-01-01
- html表格如何通过更改悬停边框来突出显示列? 2022-01-01