开发者

JavaScript content-type

开发者 https://www.devze.com 2023-01-15 17:52 出处:网络
When I add JavaScript files to web pages, I have always done for example like this: <script type=\"text/javascript\" src=\"/js/jquery.min.js\"></script>

When I add JavaScript files to web pages, I have always done for example like this:

<script type="text/javascript" src="/js/jquery.min.js"></script>
<script type="text/javascript">
    // Custom s开发者_JS百科cript
</script>

But today I discovered in the response headers that JavaScript are actually served as application/javascript. Why is that? Is both correct? Or should I change one to the other? What's going on here?


with HTML5, you can just omit the type attribute completely. All browsers assume a default type of JavaScript.

0

精彩评论

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