Careful with Script Tags in Internet Explorer

Get Help With All Aspects of Web Design & Design Software

Moderators: Moderator, Global Moderator

Post Reply
ner0
Hero Member
Hero Member
Posts: 982
Joined: Sat May 22, 2004 4:45 pm

Careful with Script Tags in Internet Explorer

Post by ner0 »

For the last week or so, I\'ve been fighting to make Internet Explorer (v6) display the content of a page I\'ve been designing for a while, after testing generally in Firefox with no problems, I came to check in IE, only to find I had -no- page content.

This was strange, as my body background-image still loaded, however I knew IE wasn\'t rendering the markup past the body tag, though it\'d still parse the actual body tag alone.

Now, once I\'d realised this, I knew it had to be something within the markup, more specifically the HEAD section. Having recently included a <script> tag, this quickly became the suspect.

Unfortunately, and possibly naively, I\'d imagined that the <script> tag, if referencing an external script file, should be self-closed, right? Wrong.

an example code would be:
[code]<script type="text/javascript" url="http://www.example.com/foo.bar" />[/code]

To me, that\'d appear as valid XHTML, as there\'s no need for anything within the script tags when referencing it externally.. though, a good lesson learned here, the solution is to always ensure there\'s a closing script tag.

Hence the solution is/was:
[code]<script type="text/javascript" url="http://www.example.com/foo.bar"></script>[/code]

Strange, really. Firefox will choose to render this anomaly correctly, gotta love IE!
[color=\"green\"]'class KPIM::ProcessManager' only defines private constructors and has no friends[/color] <- :( poor class



[18:09:00] * ~Moppy stews ner0 erotically 1 times.
Alexander
Full Member
Full Member
Posts: 243
Joined: Wed Jul 07, 2004 8:33 am

Careful with Script Tags in Internet Explorer

Post by Alexander »

If I am correct, that problem is not because of internet explorers lack of standards compatibility... javascript itself does not support self closing tags and as far as im aware, the W3C standards do not say that script tags should self close... in fact if they did self close i would see that as possibly problematic because javascript unlike CSS does not rely on single injection methods (as in CSS file goes HERE)

the problem is that most tags can self close because they are simply required to insert themselves into a document without assigning themselves to a multiple elements... javascript however requires the ability to add script tags inside the body as well as the head... if self closing occured you would be unable to specify how much of your document the Script applies to.
Last edited by Alexander on Sat Mar 10, 2007 1:37 pm, edited 1 time in total.
Sylo-X-
Sr. Member
Sr. Member
Posts: 410
Joined: Wed Jul 21, 2004 5:52 am

Careful with Script Tags in Internet Explorer

Post by Sylo-X- »

good point alex. I never really use javascript. But every time i have used it i always closed with </script>
Image

I would love to change the world, but they won't give me the source code =(

My Killa Blog
Josh
Hero Member
Hero Member
Posts: 4627
Joined: Fri Jun 04, 2004 2:54 pm

Careful with Script Tags in Internet Explorer

Post by Josh »

I tend to steer away from javascript. It\'s an evil thing I hate using; sometimes I have to though. <img src=\'http://www.killanet.net/forum3/public/s ... #>/cry.gif\' class=\'bbc_emoticon\' alt=\':(\' />
[align=center]

Image

“If you stop learning, you stop living.” ~Tami Quiring

“It's the rare man who understands the value of a single perfect rose.”

[/align]
ner0
Hero Member
Hero Member
Posts: 982
Joined: Sat May 22, 2004 4:45 pm

Careful with Script Tags in Internet Explorer

Post by ner0 »

yeah that\'s the only reason I\'m using it lol
[color=\"green\"]'class KPIM::ProcessManager' only defines private constructors and has no friends[/color] <- :( poor class



[18:09:00] * ~Moppy stews ner0 erotically 1 times.
Post Reply

Return to “Web Design Principles”