views:

25

answers:

1

I want to be able to set the MIME type of a JavaScript file so that when the file is opened in an internet browser, it is automatically executed. How would I go about doing this?

Thank you in advance for your help

+1  A: 

You can't. If you open a JavaScript in a web browser, it won't be automatically executed - even if served from a web server with the correct content-type.

Browsers only execute JS if it is linked to an HTML document (or browser plugin, etc, etc).

For a JS file to just be executed by itself, you need to use something designed to execute scripts directly (such as Windows Scripting Host).

David Dorward