views:

58

answers:

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"/&gt; it fails to render in Firefox and IE but not Chrome.

Anyone know why and a possible workaround?

+7  A: 

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

CharlesLeaf
somewhat amazingly in my opinion, this is the reason!
rutherford
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.
CharlesLeaf