[英]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.