My calls looked like this:
<script type="text/javascript" src='script1.js'/>
<script type="text/javascript" src='script2.js'/>
After scratching my skull a little more (blood was dripping already) I realized that the script tags are atomic tags, they should have no ending tag. Why would they, the content is specified in the src attribute. But on the DOM page for the script element there is an obscure line saying: Start tag: required, End tag: required. I switched to <script></script> format and it worked.
Oh, you are wondering why the first script worked? Because somehow an atomic script tag is erroneous, but it doesn't return any error. Instead it is treated like a mistyped start tag and the atomic portion of it is ignored. The second script would not load since the browser expected a script end tag. Maybe he even interpreted the second tag as an end tag for all I know.
6 comments:
I have been bleeding profusely for a number of hours before you figured out what was going on for me. Thank you very very much.
You are very very welcome. :)
I've pulled the rest of my hair out, before I found your post.
It was very helpful. Thanks a lot!
Beware xslt, you need to do something like this - substitute angle brackets for parentheses:
(xsl:text disable-output-escaping="yes")(![CDATA[(script type="application/javascript" src="myfile.js")(/script)]])(/xsl:text)
What the hell does xslt have to do with anything?
Wow, this was causing us a huge headache loading javascript in a webview in our mobile app. Leaving off the end tag worked on Android Gingerbread and iOS 4, but died quietly on Android Honeycomb and iOS 5. Thanks so much!
Post a Comment