I\'ve a simple asp.net page (framework 3.5) and an UpdatePanel with a series of dropdownlist I want to populate asyncronously. All works fine in all major browsers (Opera, S
There is a known incompatibility with Ajax.NET and Chrome & Safari 3.
Small, quick tests can be deceptive because it will appear to work fine with the existing Ajax.NET library as is. This is because it manages to perform the first Ajax request and fails when that ends, so only when you try to perform the second Ajax action will you notice it has failed. If you put an UpdateProgress control on your page, you'll notice that after the first request your UpdateProgress control won't disapppear.
Luckily, there is an answer!
Recently there was a great post put up detailing what to do which you can find here:
http://blog.turlov.com/2009/01/aspnet-ajax-compatibility-patch-for.html
The general gist of it is that both Chrome and Safari 3 report themselves as WebKit in their userAgent strings.
You need to add a little bit of javascript in to aid the Ajax.NET framework in recognising WebKit based browsers that looks like the following:
if (typeof(Sys.Browser.WebKit) == "undefined") {
Sys.Browser.WebKit = {};
}
if (navigator.userAgent.indexOf("WebKit/") > -1 ) {
Sys.Browser.agent = Sys.Browser.WebKit;
Sys.Browser.version =
parseFloat(navigator.userAgent.match(/WebKit\/(\d+(\.\d+)?)/)[1]);
Sys.Browser.name = "WebKit";
}
You need to add that to a javascript file and reference it in your ScriptManager:
Note that you can keep the WebKit.js in an assembly and reference that by using a ScriptReference tag similar to this:
Once you've done all that, if at all possible stop using WebForms and Ajax.NET and use MVC and jQuery :)