admin管理员组文章数量:1419192
I have a internet project where users print a lot. So we add "print button" in every page.
It work's fine in all browser, but google chrome.
This button just call "javacript:window.print". But when pressed, chrome opens new tab "chrome://print" just like when CTRL+P is typed.
But with CTRL+P print preview is showed fine. With "window.print" we get this message: "Print is unavailable because the page you were trying to print has been closed."
How can I solve this?
I have a internet project where users print a lot. So we add "print button" in every page.
It work's fine in all browser, but google chrome.
This button just call "javacript:window.print". But when pressed, chrome opens new tab "chrome://print" just like when CTRL+P is typed.
But with CTRL+P print preview is showed fine. With "window.print" we get this message: "Print is unavailable because the page you were trying to print has been closed."
How can I solve this?
Share Improve this question edited Oct 27, 2017 at 10:11 Mwiza 9,1213 gold badges52 silver badges44 bronze badges asked Oct 28, 2011 at 12:02 ZoteZote 5,3795 gold badges43 silver badges43 bronze badges 1- Do you have a test case? It seems to work fine on jsfiddle/pimvdb/V8nWZ. – pimvdb Commented Oct 28, 2011 at 12:05
1 Answer
Reset to default 5Try to add a "return false;" to the button to prevent the default action. So it opens the new tab, but keep the old one at the previous state.
本文标签: javascriptChrome windowprint vs ctrlpStack Overflow
版权声明:本文标题:javascript - Chrome: window.print vs ctrl + p - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745303273a2652499.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论