Connecting Tech Pros Worldwide Help | Site Map

Signed Javascript in IE

FatBo
Guest
 
Posts: n/a
#1: Nov 3 '05
Dear all,

I am writing a Javascript which print a page without prompting the
print dialog when the page is loaded. However, there is a warning box
prompted out because I am requesting the privilege of client's
computer. 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.

I am using the code to bypass the print dialog:
<script>
function Print()
{
if (document.all)
{
if (confirm("Print now?"))
{
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?

Thank you everyone !!
FatBo

VK
Guest
 
Posts: n/a
#2: Nov 3 '05

re: Signed Javascript in IE



FatBo wrote:[color=blue]
> Dear all,
>
> I am writing a Javascript which print a page without prompting the
> print dialog when the page is loaded. However, there is a warning box
> prompted out because I am requesting the privilege of client's
> computer. 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.
>
> I am using the code to bypass the print dialog:
> <script>
> function Print()
> {
> if (document.all)
> {
> if (confirm("Print now?"))
> {
> 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]

Microsoft doesn't have "Signed client-side JScript" concept as such,
it's the Netscape > FireFox way.
You can write an ActiveX control on any "real" language you have handy
right now and install it on each machine of question.
If your boss is able to cough up US$400, your customers can also
install properly signed ActiveX upon need (the security dialog will be
shown then only once during the initial installation).
Also it it's an intranet why not send printjob request to the server to
print it on the network printer?

Randy Webb
Guest
 
Posts: n/a
#3: Nov 3 '05

re: Signed Javascript in IE


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/
Closed Thread