简体   繁体   English

使用JS window.print()在Chrome中返回按钮

[英]Using JS window.print() breaks back button in chrome

I let visitors click on an image to print the page 我让访问者单击图像以打印页面

The site includes jQuery 1.6.3 该站点包括jQuery 1.6.3

In my script I've written the following: 在我的脚本中,我编写了以下内容:

$(window).load(function() {
  $('#printButton').click(function(e) {
    print();
    return false;
  });
});

Where 'printButton' is appears in my html as 我的html中的“ printButton”显示为

<img src="#" 
 id="printButton"
 ... />

The print dialog opens when the user clicks on the 'printButton.' 当用户单击“ printButton”时,将打开打印对话框。 So far so good. 到现在为止还挺好。

But my back button no longer works in chrome. 但是我的后退按钮不再适用于Chrome。 The browser doesn't go back to the previous page until I close the print dialog. 在关闭打印对话框之前,浏览器不会返回上一页。 I just get the little grey spinner on the tab. 我只是在标签上看到了灰色的微调框。

This doesn't happen if I just click CTRL-P. 如果仅单击CTRL-P,则不会发生这种情况。 I can go back to the previous page even when the print dialog is still open. 即使打印对话框仍然打开,我也可以返回上一页。

I've tried this on Chrome Version 32.0.1700.107 我已经在Chrome版本32.0.1700.107上尝试过

Any ideas on how to fix my back button? 关于如何修复后退按钮的任何想法?

Congratulations, it appears like you've found a bug in Google Chrome. 恭喜,您好像在Google Chrome中发现了一个错误。 In that case there isn't much you can do about it, other than report or forget it. 在那种情况下,除了报告或忘记它之外,您无能为力。

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

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