Chrome window.print()window.close()导致'print preview failed'。解? [英] Chrome window.print() window.close() results in 'print preview failed'. Solution?

查看:158
本文介绍了Chrome window.print()window.close()导致'print preview failed'。解?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在新选项卡或窗口中打开的打印页面。结果页面打开一个打印对话框。用户在打印对话框中进行选择后,该页面将关闭选项卡/窗口。

  window.print(); 
window.close();

这个功能在主流浏览器中效果很好,但Chrome的最新版本中有一个会打破这个即14.0.835.202)。



我收到以下来自我认为是Chrome打印插件的消息:打印预览失败。

有人有打印后关闭Chrome标签页/窗口的解决方案吗?

解决方案

我不认为有任何标准打印活动。 IE有几个,但是我意识到这对Chrome没有帮助。



我想你可能只剩下两个选项。使用 setTimeout 的手动关闭按钮或某种形式的延迟。


I have a print page that opens in a new tab or window. The resulting page opens a print dialog. After the user makes a selection on the print dialog, the page then closes the tab/window.

window.print();
window.close();

This used to work great in the major browsers, but one of the latest versions of Chrome breaks this (i.e. 14.0.835.202).

I receive the following message from what I guess is the chrome print plugin: "Print preview failed".

Does anyone have a solution to close the Chrome tab/window after printing?

解决方案

I don't think there are any standardised print events. IE has a couple, but I realise that doesn't help you for Chrome.

I think you might be left with only two options. A manual close button or some form of delay using setTimeout.

这篇关于Chrome window.print()window.close()导致'print preview failed'。解?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆