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 aut开发者_如何学Pythonomatically executed. How would I go about doing this?
Thank you in advance for your help
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).
精彩评论