简体   繁体   中英

Reason why window.print() javascript doesnt get previewed in chrome

我在页面中有一个链接,该窗口用于使用window.print()打印该页面,我想知道为什么除非在window.print()之后添加return false,否则在Chrome中不会显示预览。

return false; prevents the default action taken by the browser. In a link's case, it prevents the link from being followed.

尝试这个。

<a href="javascript:window.print();">Print</a>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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