tags:

views:

304

answers:

2

Hi,

is there anyway to stop popping up the warning message in IE when trying to execute javascript?

I want some solution which does not need modifying the settings in the IE manually by the user.

Thanks,

+2  A: 

This only occurs when you open local files. And no; there's no way to avoid this.

Or so I thought.. Untill Grant Wagner came by and gave his two cents :)

roosteronacid
@roosteronacid: The message can be avoided for an individual by configuring Internet Explorer to allow active content to run in files on your local PC. It can be avoided for everyone you send an HTML file to by including a Mark of the Web in the file you distribute. Including a MOTW will cause the script to run in the Internet Security Zone, which in this case means that the OP will see how the script behaves when uploaded to the server (with the exception of any `XMLHttpRequest`s, which won't work due to the same origin policy).
Grant Wagner
Wow. I'm floored! The <!-- saved from --> trick is pretty damn sweet :)
roosteronacid
+3  A: 

If the message is only appearing for you when you run the scripts locally and not for your visitors when you upload your scripts to the server, I'd suggest one of three things:

  1. Have a test server that you can use to run the things you are developing. This will avoid issues that might come up when you are running scripts locally. Apache or IIS should allow you to do this, although you will have to research how to get the server you choose to use working like your production environment (example: PHP).
  2. If you want to continue to test your scripts locally, you can give your pages the Mark of the Web (<!-- saved from url=(0014)about:internet -->). This will force the page to run in the Internet Security Zone and avoid the message you see when you open an HTML file containing script locally.
  3. If there is some reason you can't give the pages the MOTW, you can configure Internet Explorer to allow scripts to execute locally (note this is a bit dangerous since local files containing script can do something malicious). Go to Tools > Internet Options > Advanced tab > scroll to the Security section and check Allow active content to run in files on My Computer
Grant Wagner