IE <javascript> tag problem

Today one of my colleague Muhammad Fareed Uddin sent an email in which he described the problem related to <javascript> tag. I don't want to take credit from him so below is email I received from him:

I’ve found a bizarre behavior of html script tag (that is used to include javascript files), which I would like to share with you guys.

Sometimes, closing the tag like this <script type="text/javascript" src="User.aspx.js"/> (with “/>”) can cause some rendering problems. By that I mean, some controls may not be properly displayed or not displayed at all. (I recently faced this issue). To remedy the situation, I closed it like this : <script type="text/javascript" src="User.aspx.js"></script>, and it worked! Interestingly, IDE won’t warn you over this.

So if you’re caught into some weird rendering problem, may be it is because of the above stated reason.

Something I found that it is not bug in IE instead in an ambiguity in DTD, but question is that why only with IE?

For further information you can use following links:

http://piecesofrakesh.blogspot.com/2005/03/script-tag-in-internet-explorer.html

http://www.phpied.com/ie-script-tag-problem/

Technorati Tags: ,

Comments

Anonymous said…
Due to this bug in IE, always, always close your script tags with a separate closing tag.

See bug report here:
Bug 153
http://webbugtrack.blogspot.com/2007/08/bug-153-self-closing-script-tag-issues.html

HTH!

Popular posts from this blog

Khuda Karay K Meri Arz -e- Pak Par Utray

ME as Author for KMB!!!

میرے بعد بہت سناٹا ہوگا