开发者

JavaScript content-type

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜