开发者

Javascript is causing my page to crash in IE8 but works in chrome, firefox and safari

开发者 https://www.devze.com 2023-02-10 12:01 出处:网络
I have a page on my website that uses a lot of javascript. When loading it in firefox, chrome, safari... it loads fine.

I have a page on my website that uses a lot of javascript. When loading it in firefox, chrome, safari... it loads fine.

But when I try to view the page in Internet Explorer 8 none of the content is loaded and no error message is given.

If I delete all the javascript but leave in the javas开发者_JAVA技巧crip tags <script type='text/javascript'> </script> the page still doesn't load.

But after removing the script tags the page loads, all be it without any javascript and is therefore useless.

The page is part of an jquery tab setup. All the other tabs contain javascript and load fine, it is just this page.

Any ideas on why this is happening would be greatly appreciated.


Given the lack of information, this is only a guess but it's one of the most common reasons for scripts to fail in Internet Explore.

Check for a superfluous comma on any object properties or array members, for example

var foo = {
    bar: 'bar',
    baz: 'baz',  <-- this comma
};

This is only a problem for IE. All other browsers can deal with this syntax.


I had exactly the same Problem. In my case, there was one </div> too much before my script tags.


Most likely, as pointed out by Phil, it is caused by extra comma in any JSON object or in any array. look for the "last" element of any array & object you have. :)

0

精彩评论

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

关注公众号