简体   繁体   English

刷新新打开的窗口。从about:blank中打开

[英]Refresh a newly opened window.open from the about:blank

I open a window after getting data from an ajax result. 我从ajax结果获取数据后打开一个窗口。 The below script opens a pdf in a new window only if i resize the window size (manual hotspot resizing) otherwise pdf viewer is not displayed. 仅当我调整窗口大小(手动热点调整大小)时,以下脚本才会在新窗口中打开pdf,否则不会显示pdf查看器。

How do I make to contents to display on its popup 如何制作要在其弹出窗口中显示的内容

window.open("about:blank")
.document.write(`
<html>
<head>
    <style>
        body { 
            margin: 0
        }
    </style>
</head>
<body>
    <iframe id="iframe" src="' + data + '" scrolling="auto" frameborder="0px" marginheight="0px" marginwidth="0px" height="100%" width="100%">
    </iframe>
</body>
</html>
`);

我用aboutblank代替about:blank效果很好。

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

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