Reputation: 158361
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 script
</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?
Upvotes: 8
Views: 15388
Reputation: 4340
with HTML5, you can just omit the type attribute completely. All browsers assume a default type of JavaScript.
Upvotes: 2