When I do XMLHttpRequest, I also change window.location.hash .
For example, mysite.com/gallery/q#1 becomes mysite.com/gallery/q#2 .
When this happens, IE8, as the Fiddler and nginx logs show, makes this strange extra request to mysite.com/gallery/ (which is 404).
The page does not reload; it is similar to XMLHttpRequest.
GET http://mysite.com/gallery/ HTTP/1.1 Accept: */* Referer: http://mysite.com/gallery/q User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727) Accept-Encoding: gzip, deflate Host: mysite.com Connection: Keep-Alive
Separately, a hash change or an Ajax request will not cause this extra.
One more note - an additional request is not found for every Ajax request. This happens by chance.
Could this be the wrong nginx configuration? Or is this just one of IE8's many bugs?
Is there a workaround? I do not want this extra load.
Update
Here's the Ajax code ( $ stands for jQuery):
var id = link.getAttribute('data-id') var xhr = $.ajax({ cache: false, url: '/stock-items', method: 'GET', data: { id: id }, dataType: 'json' }) xhr.success(function (data) { if (currentId === id) { toggleLoader(false) displayData(data) } })
And hash code manipulation:
function setHash(link) { var index = $(link).index() globals.location.hash = index + 1 }
Also tried using a hash character with the same result:
globals.location.hash = '#' + index + 1
Ajax request clicks on gallery image links:
links.on('click', function (e) { setHash(this) loadData(this) e.preventDefault() })
I also tried these links so that the href attribute is set to #1 , #2 , etc. in HTML (and removed by e.preventDefault() ). So that the hash changes naturally. No, an additional request is made in any case.