FatBo said the following on 11/3/2005 5:05 AM:
[color=blue]
> Dear all,
>
> I am writing a Javascript which print a page without prompting the
> print dialog when the page is loaded.[/color]
Why? People are accustomed to seeing that dialog box. I typically use it
to Preview the page before Printing, just to make sure I get what I want.
[color=blue]
> However, there is a warning box prompted out because I am requesting
> the privilege of client's computer.[/color]
Yes, thats how most ActiveX components that are trying to go outside the
security boundaries get handled.
[color=blue]
> But my boss doesn't want to lower the security settings and
> doesn't want to see the prompt dialog. I am wonder that signing the
> javascript can solve the problem or not.[/color]
No. But what does your "boss" think about people that use browsers that
do not support the ActiveX and document.all and get the dialog from the
else{window.print()} of your function?
[color=blue]
> I am using the code to bypass the print dialog:
> <script>
> function Print()
> {
> if (document.all)
> {
> if (confirm("Print now?"))
> {[/color]
Just because the browser supports/passes the document.all test does not
mean it supports WebBrowser1.ExecWB or .outerHTML
[color=blue]
> WebBrowser1.ExecWB(6, 6) //use 6, 1 to prompt the print
> dialog or 6, 6 to omit it;
> WebBrowser1.outerHTML = "";
> //alert("print now");
> }
> }
> else
> {
> window.print();
> }
> }
> </script>
>
> Since the ExecWB(6,6) activeX control is not written by me so I cannot
> sign it. But can I get the same result if I can sign the javascript?[/color]
I hope not.
--
Randy
comp.lang.javascript FAQ -
http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices -
http://www.JavascriptToolbox.com/bestpractices/