Wednesday, March 21, 2007

Firefox 2.0.0.3 and Ajax

About three weeks ago I commented on Mozilla's "minor" update to Firefox that among other things caused the browser to completely change the way it executed dynamically loaded client scripts. This change created a few issues for RadAjax and ASP.NET Ajax since both frameworks depended on the old timing of the Firefox script execution. Telerik was able to release a fix for the issue in the Q4 2006 Service Pack 2, but Microsoft did not have the luxury of responding so quickly.

Luckily for Microsoft (and many other broken Ajax frameworks), Mozilla acknowledged the trouble they created and fixed the issue in yesterday's Firefox 2.0.0.3 update. All dynamically loaded scripts will now execute as they used to in Firefox 2.0.0.1.

For those that are curious, Telerik's RadAjax patch in SP2 changed this line:

AjaxNS.FireOnResponseEnd(instance, eventTarget, eventArgument);

To this:

//Firefox 2.0.0.2+ hack
//we "eval" the event raise code, so that it gets queued and executed
//*after* all scripts have been evaled
window.AjaxOnResponseEnd = function()
{
AjaxNS.FireOnResponseEnd(instance, eventTarget, eventArgument);
window.AjaxOnResponseEnd = null;
};
AjaxNS.EvalScriptCode("window.AjaxOnResponseEnd()");

Needless to say, to provide guaranteed compatibility for all users this hack will probably be around for a while (thanks Mozilla...). Nonetheless, your RadAjax applications should continue to work normally in Firefox 2.0.0.3+.