IE弹出窗口阻止程序阻止了Javascript window.open [英] Javascript window.open is blocked by IE popup blocker

查看:263
本文介绍了IE弹出窗口阻止程序阻止了Javascript window.open的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以提供帮助,我有一个被阻止的弹出窗口。这是一个弹出窗口,因为有人点击了我网站上的打印图片。

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.

我认为当弹出窗口来自 onclick 时,IE不应该阻止这些?

I thought IE is not supposed to block these when the popup came via an onclick?

有人可以帮忙吗?如果启用了弹出窗口阻止程序, child1 变量总是以 NULL 的形式返回...

Can anyone help? The child1 variable is always returned as NULL if popup blocker enabled...

可能问题是 onclick 事件然后将控制传递给一个新函数,该函数加载一个html文件并执行 child.document .write

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);


推荐答案

问题是open只会返回一个引用如果您要导航到当前主机中的某个位置,请到窗口。您正在导航到about:blank,这不在您的主机中。

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.

尝试将blank.htm文件添加到您的站点并将其打开。我仍然不确定document.write是否会被允许该文档不会被打开以进行写入,但您可以操作现有空白文档的DOM。

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.

这篇关于IE弹出窗口阻止程序阻止了Javascript window.open的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆