I upload a json file via ajax. If Chrome dev tools are open, everything works fine. If Chrome dev tools are closed, it fails. Fortunately, dev tools still continue to do this, even when closed, so I still see the exception that I get:
Failed to load resource: the server responded with a status of 412 (Precondition Failed) http://localhost/experiments/escape/maps/test.json
Why is there a premise that dev tools are open? In addition, it is unlikely that opening and closing dev tools can influence server behavior in any way, so I believe Chrome prevents the request, not the server, as suggested in the exception.
Unfortunately, dev tools do not monitor network activity at shutdown, so I cannot use the network tab to get additional information.
AJAX is processed through jQuery with the following code:
map.load = function(mapName, tileSource, tileWidth, tileHeight, onLoad) { $.ajax({ url: '../escape/maps/'+mapName+'.json', type: 'post', success: function(mapData) {
This code does not cause problems in Firefox and seems to be specifically connected to Chrome Dev Tools. Any suggestions are welcome as I am completely confused!
EDIT: OK, so that it does not work with tools at all - I turned off the cache in dev tools, turning it back on so that the script would work correctly. Why is my code cache dependent? Disabling / enabling the cache in Firefox does not cause any problems.
EDIT2: Well, I think I'm getting closer. A condition that is not met is the if-modified-since condition (the file has not changed). I assume chrome sends this to confirm whether to use the cached version, even though the condition is not met, it does not load the cached version. I thought this could mean that the cache was corrupted in some way, so I cleared the cache. Unfortunately, this does not solve the problem. The file will be downloaded once, but next time I will return to where I started with the same problem. Any ideas?