Javascript IE中window.closed出现问题,当使用window.open()打开PDF时

Javascript IE中window.closed出现问题,当使用window.open()打开PDF时,javascript,internet-explorer,pdf,popup,Javascript,Internet Explorer,Pdf,Popup,当我试图检查IE中弹出窗口的状态时,我遇到了一个问题 function openPopup(url) { myWindow = window.open(url, "_blank", "resizable=1,status=0,toolbar=0,menubar=0"); } function checkPopup() { console.log('Is closed : ' + myWindow.closed); } 如果我调用openPopup(“”)并在一段时间后调用c

当我试图检查IE中弹出窗口的状态时,我遇到了一个问题

function openPopup(url)
{
    myWindow =  window.open(url, "_blank", "resizable=1,status=0,toolbar=0,menubar=0");
}

function checkPopup()
{
    console.log('Is closed : ' + myWindow.closed);
}
如果我调用openPopup(“”)并在一段时间后调用checkPopup(),一切正常,我将得到“关闭:false”进入控制台,但当我调用openPopup(“”)并在一段时间后checkPopup()函数,我得到的“关闭:true”进入控制台

IE似乎创建了包含pdf的新窗口,而不是使用window.open()创建的窗口


有人能帮我吗?如何获取包含PDF文档的弹出窗口的真实状态?

通过在弹出窗口中使用嵌入式iframe进行修复:

function openPopup(link) {
    var html = "<html><head><title></title>";
    html += "</head><body style='margin: 0;'>";
    html += "<iframe height='100%' width='100%' src='" + link +"'></iframe>";
    html += "</body></html>";
    win = window.open("", "_blank", "resizable=1,status=0,toolbar=0,menubar=0");
    win.document.write(html);
    return win;
}
函数openPopup(链接){
var html=“”;
html+=“”;
html+=“”;
html+=“”;
win=window.open(“,”_blank“,”可调整大小=1,状态=0,工具栏=0,菜单栏=0”);
win.document.write(html);
回归胜利;
}

通过在弹出窗口中使用嵌入式iframe修复:

function openPopup(link) {
    var html = "<html><head><title></title>";
    html += "</head><body style='margin: 0;'>";
    html += "<iframe height='100%' width='100%' src='" + link +"'></iframe>";
    html += "</body></html>";
    win = window.open("", "_blank", "resizable=1,status=0,toolbar=0,menubar=0");
    win.document.write(html);
    return win;
}
函数openPopup(链接){
var html=“”;
html+=“”;
html+=“”;
html+=“”;
win=window.open(“,”_blank“,”可调整大小=1,状态=0,工具栏=0,菜单栏=0”);
win.document.write(html);
回归胜利;
}

乍一看,如果我在Chrome中按ctrl+p键,这似乎无法正确打印。乍一看,如果我在Chrome中按ctrl+p键,这似乎无法正确打印。