Does anyone know any fix or new method to be used with Javascript.
Thanks a lot
Jordi Codina i Chacon
Thanks a lot
Jordi Codina i Chacon, - MEV...@noemail.noemail
Please be advised that currently there is no way for printing
programmatically from script without bringing up a prompt because this
would be a security hole. For more information please see the following KB
article:
PRB: Printing with WebBrowser from Internet Explorer Raises Print Dialog
Box in Internet Explorer 5
http://support.microsoft.com/kb/247671
Our proposed solution would be to host an activex control and get a handle
to IWebBrowser2 interface of that window where you are calling the print
command. Then you can call the execWB command on the interface where you
can pass the OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER param. For more
details on how to get the handle for the IWebBrowser2 interface please
refer to the articles below:
http://support.microsoft.com/?id=257717
http://support.microsoft.com/?id=172763
For more details on the IWebBrowser2::ExecWB Method please refer to the
article below:
http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/webbrows
er/reference/ifaces/iwebbrowser2/execwb.asp
The OLECMDID enumeration specifies which command to execute. Please refer
to below article for more details:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/com/html/ae
1592b6-2afd-4379-a18e-d46b226bc9e2.asp
The OLECMDEXECOPT enumeration specifies command execution options where you
can specify OLECMDEXECOPT_DONTPROMPTUSER to avoid the printer prompt.
Please refer to the article below for more details:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/com/html/62
45725e-51d4-40e1-8cf1-a65657e790ef.asp
Hope this helps.
Sincerely,
Walter Wang (waw...@online.microsoft.com, remove 'online.')
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Thanks for your info regarding how to solve this problem. However it still
not so clear for us because what you say is the solution that we think was
implemented.
In an HTML page, we call the following javascript code:
…
var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0
CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
WebBrowser1.ExecWB(6,2);
WebBrowser1.outerHTML = "";
…
When we execute this code in a W2K machine it works fine (No print dialog
box is opened, i.e. it prints directly). However using the same code in XP
(SP2) the print dialog appears.
Please, can you clarify if there's any way to print directly from a
javascript function in an HTML page without the print dialog appears?
Thanks again for your help.
Jordi Codina i Chacon
I'm sorry I didn't describe more clearly in last reply.
What I meant is that:
On Windows XP SP2 and later, there're many security improvement in IE; and
this is one of the retrictions introduced: there's no way for client-side
script to print the page without prompting user.
The other parts of the last reply is about hosting web browser in your own
application. It seems doesn't apply for your scenario, so you could safely
ignore them.
Please let me know if there's still anything unclear.
Regards,
Walter Wang (waw...@online.microsoft.com, remove 'online.')
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.