Javascript MIME-type in Internet Explorer

Just wasted an hour debugging a simple site because of this.

When writing inline javascript for IE, don't use the standard application/javascript-type because Internet Explorer won't run the code.

<!-- Doesn't work with IE -->
<script type="application/javascript">
    var testing = 1;
</script>

Just change the MIME-type to text/javascript and you're good to go:

<!-- Works in all browsers -->
<script type="text/javascript">
    var testing = 1;
</script>

Back to the index