在Chrome中禁用打印预览 [英] Disable print preview in Chrome

查看:1123
本文介绍了在Chrome中禁用打印预览的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在Chrome中使用javascript禁用打印预览?我需要在Web应用程序中打开一些弹出窗口,并打印一些文本;在这个弹出窗口中,当页面被加载时,我有下面的代码:

  $(document).ready(function() {
window.print();
});

一个打开打印预览页面的简单JavaScript;现在,发生的情况是打印预览页面的行为类似于模式对话框:我无法在打开打印页面的应用程序中导航(即使链接是可点击的)。如果普通系统对话框可用,则不会显示此行为(实际上,在IE浏览器和Firefox中我没有这个问题)。
那么,有没有办法告诉Chrome浏览器通过JavaScript禁用打印预览?

解决方案


有没有办法在Chrome中使用JavaScript来禁用打印预览?


否(通过javascript)。谷歌与其他公司一样,喜欢保持一致的用户体验。如果程序员能够改变chrome在HTML以外的不同页面上的工作方式,那将是一种糟糕的用户体验。

现在,发生的事情是打印预览页面的行为类似于模式对话框:我无法在打开打印页面的应用程序中导航(即使链接是可点击的)。

相反,您可以使用相同的数据打开一个新窗口并使用hava javascript进行打印。前一个窗口可以正常工作(假设由于附加组件/配置,新窗口不会在新选项卡中打开)。


Is there a way to disable the print preview in Chrome using javascript? I need to open a pop-up in a web application with some text to print; in this pop-up I have the following code when the page is loaded:

$(document).ready(function () {
    window.print();
}); 

a simple JavaScript that opens the print preview page; now, what happens is that the print preview page behaves like a modal dialog: I cannot navigate anymore in the application that has opened the print page (even though the links are clickable). This behavior doesn't show up if the normal system dialog is available (and in fact, I don't have this problem in IE Explorer and in Firefox). So, is there a way to tell Chrome to disable the print preview through a JavaScript?

解决方案

Is there a way to disable the print preview in Chrome using javascript?

No (through javascript). Google like every other company, likes to keep a consistent user experience. If programmers were able to change how chrome worked on different pages beyond html, that would be a poor user experience.

now, what happens is that the print preview page behaves like a modal dialog: I cannot navigate anymore in the application that has opened the print page (even though the links are clickable).

Instead, you could have a new window open with the same data and hava javascript do a print. The previous window would work normally (assuming the new window doesn't open in a new tab because of add-ons/configuration).

这篇关于在Chrome中禁用打印预览的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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