thicket
02-16-2010, 07:36 PM
Hi -
I think this is an old problem but am unable to resolve it.
Am implementing unobtrusive javascript. If javascript is enabled I have a function that 'ajaxifies' all my links - this works fine in the usual browsers as well as IE6 and IE8.
In IE7 (7.0.6000.16982) however, when an 'ajaxified' link is clicked data is downloaded and displayed in the browser ok (after some css hacks/modifications that is). IE7 then keeps calling the same function that downloads the data. It loops indefinitely ...
Am running 'lighttpd' on ubuntu - the logs show that no additional requests for the same data are being made/logged. Yet to monitor the network.
To date I have found that this may be an old problem circa 2006/7 for IE7 where the ActiveX XHR object continues to resend the XMLHttpRequest. The solution is to use the native IE7 XHR object instead of the ActiveX one. However have yet to see any evidence of this in logs. What I do see is the IE7 client repeatedly calling the function that downloads data to the client.
I'm using JQuery (latest version) - so I would of expected this issue to have been resolved.
So - if it is this problem how do I get JQuery to use the native IE7 XHR object?
If it is not this problem - does any one have any ideas please.
####
Am fairly sure now that this is the problem. JQuery's $.ajax() default's to using the ActiveX XHR. I noted on Microsoft's Development Network that they recommend that the ActiveX XHR should be used as a 'last resort' and it is this that causes the looping.
It is possible to change $.ajax()'s default behaviour via '$.ajax({xhr:"...."})' - just do not know what to use in place of "...." so that IE7's native XHR is used?
###
Fixed:
Tried using the native xhr object -
.....
var brwsr = detect_ie();
if ( brwsr == "IE7" ){
$.ajaxSetup({xhr:function(){
return new XMLHttpRequest();
}});
}
....
No joy. The problem was not with either xhr but with a function that was being called after an async. transfer had completed. Without boring you with the details - in IE7 - if an event is added to a tag that already has the same event bound to it then IE7 appears to run any function associated with the callback directly which in my case caused the looping. FF and other versions of IE appear to 'do nothing' when this scenario occurs.
Modified my code to use .live(event, callback) and removed the offending function from the 'ajax it' function.
I think this is an old problem but am unable to resolve it.
Am implementing unobtrusive javascript. If javascript is enabled I have a function that 'ajaxifies' all my links - this works fine in the usual browsers as well as IE6 and IE8.
In IE7 (7.0.6000.16982) however, when an 'ajaxified' link is clicked data is downloaded and displayed in the browser ok (after some css hacks/modifications that is). IE7 then keeps calling the same function that downloads the data. It loops indefinitely ...
Am running 'lighttpd' on ubuntu - the logs show that no additional requests for the same data are being made/logged. Yet to monitor the network.
To date I have found that this may be an old problem circa 2006/7 for IE7 where the ActiveX XHR object continues to resend the XMLHttpRequest. The solution is to use the native IE7 XHR object instead of the ActiveX one. However have yet to see any evidence of this in logs. What I do see is the IE7 client repeatedly calling the function that downloads data to the client.
I'm using JQuery (latest version) - so I would of expected this issue to have been resolved.
So - if it is this problem how do I get JQuery to use the native IE7 XHR object?
If it is not this problem - does any one have any ideas please.
####
Am fairly sure now that this is the problem. JQuery's $.ajax() default's to using the ActiveX XHR. I noted on Microsoft's Development Network that they recommend that the ActiveX XHR should be used as a 'last resort' and it is this that causes the looping.
It is possible to change $.ajax()'s default behaviour via '$.ajax({xhr:"...."})' - just do not know what to use in place of "...." so that IE7's native XHR is used?
###
Fixed:
Tried using the native xhr object -
.....
var brwsr = detect_ie();
if ( brwsr == "IE7" ){
$.ajaxSetup({xhr:function(){
return new XMLHttpRequest();
}});
}
....
No joy. The problem was not with either xhr but with a function that was being called after an async. transfer had completed. Without boring you with the details - in IE7 - if an event is added to a tag that already has the same event bound to it then IE7 appears to run any function associated with the callback directly which in my case caused the looping. FF and other versions of IE appear to 'do nothing' when this scenario occurs.
Modified my code to use .live(event, callback) and removed the offending function from the 'ajax it' function.