开发者

How Do I Set MIME Type Of A Local File?

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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜