简体   繁体   English

Javascript-如何在首次显示后禁用打印对话框?

[英]Javascript - How to disable the print dialog after first show?

On one of our pages the user has the option to print a selected list of html pages. 在我们的页面之一上,用户可以选择打印选定的html页面列表。 This is how it is at the moment 目前就是这样

var rowcount = FrmMain.RowCount;
var frame = FrmMain.Frame;
for(i=1;i<=rowcount;i++)
{
    var obj = FrmMain.elements("chk_" + i);
    if(obj.checked)
    {
        frame.src = FrmMain.elements("hpath" + i).value;
        window.frames[frame.id].focus();
        window.frames[frame.id].print();
    }
}

Now this works fine. 现在可以正常工作了。 The problem is that on each loop the print dialog box is displayed and the user has to click print. 问题是在每个循环上都会显示“打印”对话框,并且用户必须单击“打印”。

Basically, what I'm asking is whether that is a way to supress this dialog. 基本上,我要问的是这是否是抑制此对话框的方法。 It must appear at the first time but hide thereafter. 它必须在第一次出现但在之后隐藏。 Some thing like below 像下面这样

var show = true;
...
{
    ...
    {
        ...
        if(show)
        {
            window.frames[frame.id].focus();
            window.frames[frame.id].print();
            show = false;
        }
        else
        {
            window.frames[frame.id].focus();
            window.frames[frame.id].printwithoutdialog();
        }
    }
}

I hope I've been clear. 我希望我已经清楚了。 Thanks in advance. 提前致谢。

For security / privacy reasons, this is impossible. 出于安全/隐私原因,这是不可能的。
Otherwise, ads would automatically print their brochures. 否则,广告将自动打印其小册子。

Instead, you can combine all of the pages into a single frame. 相反,您可以将所有页面合并到一个框架中。

某些浏览器提供绕过对话框的选项,但无法使用javascript完成。

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

相关问题 第一次单击javascript后如何禁用按钮 - how to disable button after first click in javascript 如何禁用Windows打印对话框? - how to disable windows print dialog? 如何在JavaScript中显示对话框? - How to show a dialog in javascript? 如何在按下CTRL + P后使用JavaScript禁用打印弹出窗口 - How to disable print pop up with JavaScript after pressing CTRL + P 第一次单击javascript后如何禁用锚标记? - How to disable anchor tag after first click in javascript ? 如何在 PHP 和 Javascript web 应用程序的打印对话框中禁用“另存为”选项。 如果打印机已连接且未下载,则应出现该对话框 - How to disable “Save As” option in print dialog in PHP and Javascript web application. The dialog should appear if printer is connected no downloading 如何在Google Chrome浏览器中使用JavaScript显示窗口打印对话框? - How can I show the window print dialog using JavaScript in Google Chrome? 如何从javascript显示打印对话框而不会收到“Page Unresponsive”警告? - How to show print dialog from javascript without getting “Page Unresponsive” warnings? 第一次点击javascript后,禁用表格单元格 - Disable a table cell after the first click in javascript 第一次点击后,javascript禁用事件监听器 - javascript disable event listener after first hit
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM