Thursday, March 24, 2011

IE JavaScript Problem with JavaScript Opening Tag

I hope to save some time for those struggling with a JavaScript problem.  I could not get my Javascript snippet to work and I knew there were no errors. 

Here is the issue.  I couldn't figure out why my Javascript was not executing even a simple alert() function.  After blaming all the complicated code and double checking my trailing comma's I finally broke it down into simple terms.

<script>
 alert("hello");
</script>

and it worked.  So I began digging into why.  My editor generated the tag so I didn't question it until I noticed the difference.

<script language="javascript" type="application/javascript">

That led me here:


http://stackoverflow.com/questions/1288263/why-doesnt-ie8-recognize-type-application-javascript-in-a-script-tag



So I hope this helps someone when their JavaScript is not executing and their editor is the cause.



























Brian J. has been involved in web design since 1997. He is the founder of True Vision Computer Services, Inc. His recent focus has been on web applications and information systems development.

No comments: