1

I am producing a javascript-based widget. Nothing complex just a few document.writes...

When I place it inline in the page it renders fine in all browsers. When I place it externally and load it via <script src="http://example.com/path/to/site"/> it fails to render in Firefox and IE but not Chrome.

Anyone know why and a possible workaround?

3
  • Please provide more detail. Where is the <script> tag? Commented May 30, 2010 at 16:52
  • u missed off the type="text/javascript" Commented May 30, 2010 at 17:09
  • 1
    type="text/javascript" is not needed in the <script> tag since JavaScript is presumed as the default scripting language in every browser. You only need it for VBScript (if there's still somebody using it). Commented May 30, 2010 at 19:32

1 Answer 1

8

Maybe you should close it with </script> instead of XML-style.

Sign up to request clarification or add additional context in comments.

2 Comments

somewhat amazingly in my opinion, this is the reason!
Yeah it's a rather silly one, but it's because (x)HTML pages are usually rendered with a HTML/SGML based render engine instead of XML, because most people serve them with a text/html content-type. I myself am used to typing <script />, but that's because I use XSL(t) for templates and the XSL library transforms it to </script> automatically so I don't have any problems.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.