IE won't load PDF in a window created with window.open

随声附和 提交于 2019-12-04 00:09:19

try:

function newwin(url,w,h) {
     var win = window.open("","temp","width="+w+",height="+h+",menubar=yes,toolbar=yes,location=yes,status=yes,scrollbars=auto,resizable=yes");
     win.location.href = url;
     win.focus();
}

I have solved this problem with an invisible iframe

<div id="iframe" style="display: none">
  <iframe id="frm" style="display: none"></iframe>
</div>

And this logic here (using jquery):

if ($.browser.msie && ($.browser.version &lt; 9.0)) {
  frm.location.href = href;
}
else {
  window.open(href);
}

The behaviour in my case is exactly as if the document was opened in a popup, as I'm using

Content-Disposition: attachment; filename="document.pdf"
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!