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.
精彩评论