开发者

How Do I Set MIME Type Of A Local File?

开发者 https://www.devze.com 2023-01-13 20:34 出处:网络
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?

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

精彩评论

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

关注公众号