Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Javascript sometimes not load in IE8

I have external javascript files that get loaded in my master page.

Sometimes in IE8, my javascript files don't load correctly and the browser throws a bunch of javascript errors saying 'object not recognized.'

If I refresh the page then everything is fine. If I click on a link then the problem sometimes occurs again.

I have meta tags in my header for clearing out the cache on each request. I'm using the head.load library to load my js files in parallel.

The head.load library is located in my header and the external files are at the end of my body.

Please remember that this problem only occurs in IE8. So my question is..drum roll please..is there a hack that I can use to make sure my javascript files are loaded correctly each time the page loads for IE8?

Any help would be greatly appreciated.

Updated as requested

<head runat="server">
    <meta http-equiv="CACHE-CONTROL" content="NO-CACHE" />
    <meta http-equiv="PRAGMA" content="NO-CACHE" />
    <meta http-equiv="EXPIRES" content="-1" />
    <script type="text/javascript" src="scripts/js/head.load.min.js"></script>
</head>
<body>
<script type="text/javascript">
    head.js("scripts/js/jquery-1.6.2.min.js");
    head.js("scripts/js/jquery.cookie.js");
    head.js("lib/gritter/jquery.gritter.min.js");
    head.js("lib/fancybox/jquery.easing-1.3.pack.js");
    head.js("lib/fancybox/jquery.fancybox-1.3.4.pack.js");
    head.js("scripts/js/jquery.microaccordion.js");
    head.js("scripts/js/jquery.stickyPanel.js");
    head.js("scripts/js/guidely.js");
    head.js("scripts/js/pto.js");
</script>
</body>
like image 985
damaniel Avatar asked Feb 20 '12 19:02

damaniel


1 Answers

Ok, the problems appears to be how the head.load library loads my externals in IE8. If I load jquery before I load the head.load library, and then load my externals in parallel at the end of the page; then there's no javascript errors. A little lesson for myself about javascript loading and IE8.

Thank-you everyone for the input.

@ frederic - I work at a company that has 188,000 employees. If a user has an add on installed in their browser that is causing my page to crash then there's nothing I can do about that. I also don't think this problem is being caused by any add ons. Its just how the head.load library is handled in IE8.

<head runat="server">
    <meta http-equiv="CACHE-CONTROL" content="NO-CACHE" />
    <meta http-equiv="PRAGMA" content="NO-CACHE" />
    <meta http-equiv="EXPIRES" content="-1" />
    <script type="text/javascript" src="scripts/js/jquery.min.js"></script>
    <script type="text/javascript" src="scripts/js/head.load.min.js"></script>
</head>

<script type="text/javascript">
    head.js("scripts/js/jquery.cookie.js");
    head.js("lib/gritter/jquery.gritter.min.js");
    head.js("lib/fancybox/jquery.easing-1.3.pack.js");
    head.js("lib/fancybox/jquery.fancybox-1.3.4.pack.js");
    head.js("scripts/js/jquery.microaccordion.js");
    head.js("scripts/js/jquery.stickyPanel.js");
    head.js("scripts/js/guidely.js");
    head.js("scripts/js/pto.js");
</script>
like image 120
damaniel Avatar answered Oct 13 '22 06:10

damaniel