Expected $ ajax request - chrome caching issue?

please also check my updates below

I have some problems running cross domain jQuery.ajax GET REQUEST in Chrome.

The preliminary battle lasts a very long time (up to 20 seconds), while it works well in Firefox.

I tried different tips (like turning on async), but I can't do this. The answer is an array of json objects and not very large (just a few bytes).

The problem seems to be only on the first call. I made a function that executes the request again. It was executed by a success handler. After the first delay of min. 12 seconds, the request is executed normally.

I already tried different versions of jQuery (as I use 2.0.3 for the first time).

I registered a server. As expected, the OPTION request does not execute until 20 seconds. There is no problem with the server. The server recognizes the command exactly according to the delay and executes the GET method.

For the loaded page 2014-01-11 14:59:00 my logical outputs are as follows:

2014-01-11 14:59:14 - log.txt - "OPTIONS /unit/IO/*?_=1389452340572 HTTP/1.1" 200 -
2014-01-11 14:59:14 - log.txt - "GET /unit/IO/*?_=1389452340572 HTTP/1.1" 200 -
2014-01-11 14:59:14 - log.txt - "OPTIONS /unit/IO/*?_=1389452340573 HTTP/1.1" 200 -
2014-01-11 14:59:14 - log.txt - "GET /unit/IO/*?_=1389452340573 HTTP/1.1" 200 -

This is my ajax call:

$.ajax({
url: <<crossdomain>>,
type: 'GET',
contentType:'application/json',
async:true,
    cache:false,
beforeSend: function (request)
    {
    request.setRequestHeader("Authorization", 'Basic ' + encodedData);
},         
success: function(response) {
        alert(response)
}
});

Request Header (Chrome):

Accept:*/*
Accept-Encoding:gzip,deflate,sdch
Accept-Language:de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
Access-Control-Request-Headers:accept, authorization, content-type
Access-Control-Request-Method:GET
Cache-Control:max-age=0
Connection:keep-alive
DNT:1
Host:<<crossdomain>>
Origin:<<thisdomain>>
Referer:<<directpathonthisdomain>>
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36

Answer Header (Chrome):

Access-Control-Allow-Headers:Authorization
Access-Control-Allow-Headers:Accept
Access-Control-Allow-Headers:Content-Type
Access-Control-Allow-Headers:Accept-Language
Access-Control-Allow-Methods:POST, GET, OPTIONS
Access-Control-Allow-Origin:*
Cache-Control:no-cache
Content-Type:application/json
Date:Sat, 11 Jan 2014 13:28:32 GMT
Server:Python3.2

This is the network traffic for the first call:

Chrome:

PARAMETER

DNS Lookup: 0 ms
Connecting: 3 ms
**Waiting: 17.44s**
Receiving 2 ms

Get

DNS Lookup: 0 ms
Connecting: 2 ms
Sending: 0 ms
Waiting: 46 ms
Receiving 1 ms

For comparison: Firefox magazine:

PARAMETER

DNS Lookup: 0 ms
Waiting: 10 ms
Receiving 5 ms

Get

DNS Lookup: 0 ms
Waiting: 41 ms
Receiving 3 ms

EDIT: No problem if I open the html file directly (file: ///) and do not host the local / remote server.

EDIT 2: It works in incognito chron mode - can there be a cache problem?

+4
source share
2

. , " " Chrome, .

+6

, ajax.

headers: {
    "Cache-Control" : "no-cache, no-store, must-revalidate",
    "Pragma": "no-cache",
    "Expires", "0"
}
0

All Articles