admin管理员组文章数量:1333210
I want to create a print button so that when it is pressed, it prints the whole webpage. I am currently using Window.print() of javascript. But I ran into error; when ever i press the print button more than once, the link stops working. What is the problem with it ? Is there an alternative to this in jquery or any other ? I am using grails 1.3.7. Thanks
I want to create a print button so that when it is pressed, it prints the whole webpage. I am currently using Window.print() of javascript. But I ran into error; when ever i press the print button more than once, the link stops working. What is the problem with it ? Is there an alternative to this in jquery or any other ? I am using grails 1.3.7. Thanks
Share Improve this question asked Apr 17, 2012 at 4:59 Eddard StarkEddard Stark 3,5958 gold badges36 silver badges52 bronze badges 3-
whatever the problem with it is, it isn't that you are using
window.print()
(which is the only way to get the browser to print something without using its native UI). – Quentin Commented Apr 17, 2012 at 6:09 - 2 my wild guess is that you are using chrome and it blocks window.print() if pressed too many times. Check out your javascript console to see if it spits an error or warning. – Hassek Commented Apr 18, 2012 at 22:13
- 1 Yes i was using chrome, and after your ment I checked it in firefox, it is working fine there. Is there any way in chrome to make this work ? – Eddard Stark Commented Apr 19, 2012 at 4:39
1 Answer
Reset to default 4An alternative way to window.print()
is
document.execCommand('print');
本文标签: javascriptAlternative to WindowPrint()Stack Overflow
版权声明:本文标题:javascript - Alternative to Window.Print() - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742274940a2445017.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论