Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ActiveX error in printpreview JS

 
PraveenKumar Kannankutty
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,

Iam using the following piece of java script code, to implement the Print Preview functionality.

function printpr()
{
var OLECMDID = 7;
/* OLECMDID values:
* 6 - print
* 7 - print preview
* 1 - open window
* 4 - Save As
*/
var PROMPT = 1; // 2 DONTPROMPTUSER
var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
WebBrowser1.ExecWB(OLECMDID, PROMPT);
WebBrowser1.outerHTML = "";
}

The code works fine if the same is executed from the local system, but an ActiveX error is displayed when the same is executed over the net.

Can anyone kindly help me in resolving this issue.

Thanks in Advance,
PK.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have different settings for local and internet most likely.

Eric
 
PraveenKumar Kannankutty
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are right Eric, the problem is because of the Internet Security settings. But how do I overcome this.

Your valuable comments please...


Regards,
Praveen.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
there is nothing you can do. If you could change the setings from a web page it would defeat the security.

Eric
[ April 06, 2006: Message edited by: Eric Pascarello ]
 
PraveenKumar Kannankutty
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But how does the Print Preview functionality implemented in the MENU Bar[In FILE] of IE works fine.

Is it because it is implemented in a different way, not by using the JS that I have mentioned in my earlier post?


Regards,
Praveen.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic