Vikram

Vikram

  • NA
  • 1
  • 0

unable to execute a javascript in a dynamically generated HTML using XSLT in C#

Jan 9 2006 11:46 PM

Hi,

I have a dynamically generated HTML code rendered on a browser instance

created though code (AxSHDocVw.AxWebBrowser instance) . I have used a
javascript to generate a print preview.

function printPreview () {
var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0
CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';

document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
WebBrowser1.ExecWB(7, 1);

}

But when I try to execute this script on the click of a button , I get
the following error:

"An Activex Control on this page is not safe."
Your current security settings prohibit running unsafe controls on this

page.

I do not have any option to modify the security settings as the browser

instance what I have is instantiated through code
(AxSHDocVw.AxWebBrowser  object)

Also, when I use the same HTML code and save it on the disk and then
open the file, the Javascript executes without any problems.

Can anyone provide a solution as to how I can prevent this error and
execute the script successfully ?