简体   繁体   English

在弹出窗口中显示PDF会导致window.close为true

[英]Displaying PDF in popup causes window.close to be true

I displayed a PDF in a popup window (IE11), tried to close the popup using the child window object but found that its already closed but the pdf if still open. 我在弹出窗口(IE11)中显示了PDF,试图使用子窗口对象关闭弹出窗口,但发现它已经关闭,但是pdf如果仍然打开。 This makes it evident that Acrobat is still working. 这表明Acrobat仍在工作。 Is is possible to close this from the browser using java-script? 可以使用Java脚本从浏览器中关闭它吗? I tried embedding the pdf in iframe but its still not working.. 我尝试将pdf嵌入iframe,但仍然无法正常工作。

Is there a work around for this using JavaScript? 使用JavaScript是否可以解决此问题?

var win; win = window.open('" + vServletURL +
            "','_blank',\"height=300,width=200,scrollbars=no,status=no, resizable=no\");"+
            "setTimeout(function(){if(!win.closed)win.close();},5000);

To popup the pdf.. my servlet builds the pdf; 弹出pdf ..我的servlet建立了pdf;

OutputStream out = response.getOutputStream();out.write(baos.toByteArray()); out.flush(); out.close();

were baos being ByteArrayOutputStream 包是ByteArrayOutputStream

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM