开发者

IE8 displays white page when adding Javascript

开发者 https://www.devze.com 2022-12-23 12:50 出处:网络
I recently created a website and added some jQuery into it. However doing this makes IE8 display a white page. Whenever I remove the Javascript IE8 renders the site fine. I have tested locally as well

I recently created a website and added some jQuery into it. However doing this makes IE8 display a white page. Whenever I remove the Javascript IE8 renders the site fine. I have tested locally as well as on the internet, the problem still persists.

This is my code to 开发者_如何转开发include my .js files:

<script type="text/javascript" src="jQuery/jQuery.js" />
<script type="text/javascript" src="jQuery/effects.js" />


Try closing the script tags the HTML way:

<script type="text/javascript" src="jQuery/jQuery.js"></script>
<script type="text/javascript" src="jQuery/effects.js"></script>

The reason for this is probably that IE can't parse XHTML, instead it tries to convert XHTML to regular HTML and chokes on script tags that uses ending-slash for closing.


Self-closing tags are part of XHTML, not HTML. No versions of IE before IE9 support XHTML so I'll assume that you're serving HTML. Close script tags in HTML with </script>.


Self-closing script tags are not interpreted in HTML by any version of Internet Explorer. It seems to be a very strict interpretation of rules.

You will need to close the <script> tags explicitly.

<script type="text/javascript" src="jQuery/jQuery.js" ></script>
<script type="text/javascript" src="jQuery/effects.js"></script>

See this question

0

精彩评论

暂无评论...
验证码 换一张
取 消