IE8 AJAX error: javascript is not loaded

500 views Asked by At

I have a fairly complicated page built using JSP, JavaScript, jQuery, and css. It works fine in Chrome, Firefox, and IE10. However, it doesn't work in IE8 - JavaScript specific to that particular page doesn't load, the HTML is broken, some css is loaded, but not all.

The page called via an AJAX call:

jQuery.ajax({
            url : url,
            dataType: "html",
            cache : false,
            beforeSend : ...

Capturing network activity in Developer tools shows that the relevant script files have started to arrive, but only 155B-157B were received. Result code is 304, time is shown as under 1ms. Same reporting for Chrome shows that the same JS files are 3-7-12KB in size, took 3-10ms to arrive, with HTTP code 200.

The same page requested via a regular GET request loads normally. The problem looks like a known aggressive-caching issue in IE8, but somehow setting cache : false doesn't prevent 304 from happening.

How can I make this work?

Using jQuery version 1.4.2, IE8 on Win7. tc Developer server 2.8.2.

1

There are 1 answers

0
jprusakova On BEST ANSWER

One of the JavaScript files being retrieved via the AJAX call contained, among other code, this method:

    jQuery(document).ready(function() {
    return validate...();
}

IE8 was not able to process it, and discarded all surrounding JavaScript.

I removed the lines above, and moved the validation method to the function that was called on Complete: of that AJAX call, and everything started working.