在NWJS中,我想打印显示的第二个窗口。我试过这样做:
<html>
<head>
<title>Test</title>
<script>
nw.App.registerGlobalHotKey(new nw.Shortcut({
key: "F11",
active: function() {
nw.Window.get().toggleFullscreen();
}
}));
nw.App.registerGlobalHotKey(new nw.Shortcut({
key: "ctrl+p",
active: function() {
window.print();
headerFooterEnabled: false;
}
}));
</script>
</head>
<body>
<iframe id="quick" src="https://www.quackit.com/html/codes/html_open_link_in_new_window.cfm" style="display:inline-flex; position:fixed; width: 100%; height:100%; bottom:0; right:0; top:0; left:0;"></iframe>
</body>
</html>
脚本正常运行,直到我单击nwjs框架内链接,这将打开一个新窗口(第二个窗口)。我想打印第二个窗口,但打印预览总是显示第一个窗口。
有人能帮帮我吗?
发布于 2019-03-18 17:38:03
框架的嵌套深度与此无关,只要它有一个可访问的ID即可。
所以这对我总是有效的..。
FrameID.contentWindow.print();;
FrameID.focus();
https://stackoverflow.com/questions/54998320
复制相似问题