Views: 5763
Number of votes: 0
Average rating:

Self Closing Script Tags in Internet Explorer

It turns out that all versions of Internet Explorer do not like self closing script tags or as the Internet world calls it, element minimization. Self closing script tags are perfectly valid XHTML elements, but invalid HTML elements. Internet Explorer only supports XHTML to the extent that only HTML-compatible markup is possible. All other major browsers support XHTML markup.

The below example shows how this can be detected when script tags have been placed within the head element of a HTML page.


For the above, the 'NavTo' function would never be known to the body or other JavaScript files. In order for subsequent JavaScript files or code to be executed, the script tag of the offending element must be correctly formatted according to HTML markup standards. This will allow all browsers including Internet Explorer to successfully execute all JavaScript.


Aug 21, 2009

Please login to comment.