Safari 3 is detected as Sys.Browser.Safari. There are specific hacks for Safari implemented in MicrosoftAjax.js. These hacks cause problems with Safari 3 as it uses a new javascript rendering engine called WebKit.
The hacks can cause dreaded errors like when updating a control's visibility from false to true in an updatepanel during a partial update. When that occurs it needs to download the supporting javascript to run the now visible server control. With the hacks
in place it does not properly dynamically load the javascript file and it throws the following error:
Sys.ScriptLoadFailedException: The script 'http://localhost:2241/WebResource.axd?d=hvpXhV5kEMwLgAoaIglURevR_XTtDTBoKZ3aZWWaIvEkBXbLudri1AIv5bRs5f6licjCZMs3Z3MioQLqLTXV98582pKDHkD7BucGkKsPLz41&t=633444640020014740' failed to load. Check for:
Inaccessible path.
Script errors. (IE) Enable 'Display a notification about every script error' under advanced settings.
Missing call to Sys.Application.notifyScriptLoaded().
Now WebKit runs MicrosoftAjax.js without any problems. So I have modified the following to detect a new browser type called WebKit.
In the file called "MicrosoftAjax.debug.en-US.js" (do the same for the other cultures)
The problem is that if we remove the Safari hacks then Safari 2 will stop working with AJAX. I guess it would be possible to go through all the .js files and find where each hack is and add a version check on top of the browser check.
Safari 3 is just a nice gui on top of WebKit. I like adding WebKit as a browser type as there are a number of other browsers that use WebKit at its core. This allows us to make WebKit specific "optimizations" if necessary and results in it being applied
to all WebKit browsers.
We are noticing the same problems using the ASP.NET 2.0 version of the Microsoft AJAX Library ("version 1.0" ???).
How can we change this in the built DLL (or override it)? All of the source code available for the library only includes the CS and JS files. There are no project files included in the download.
I'm using system.web.extension and i can rebuild it (there is no source code). So does any of you can rebuild dll with this fix ? Or tell me where can i found source code for this ?
Hi, I've got some issues under Safari 3. I've just modified applied the code you've mentioned to the following file. However, the problem (with Panel Refreshing) is still there. "C:\Program Files\Microsoft ASP.NET\ASP.NET 2.0 AJAX Extensions\v1.0.61025\MicrosoftAjaxLibrary\System.Web.Extensions\1.0.61025.0"
How am I supposed to apply this patch? How should I compile the changes into a new .dll???? Thanks.
There are 2 possible ways of doing this. You can replace each script reference or you can set a path for all scripts. Note that it is important that the folder structure remains that same. It needs the namespace and version to calculate where the files are.
Don't forget there are a couple of different versions. There is live and debug as well as culture specific files.
This patch will also allow Google Chrome browser to work MS Ajax as it is based on webkit. Google chrome uses webkit and has a compatible user agent, so it is detected as webkit.
I've experimented with this bug a lot, and the best temporary solution is the one proposed by
kshakir (second post in this thread). Simply create a single JS file with his code and reference it in your site. To work properly, this script should be loaded before any AJAX control scripts. For my applications, I simply reference it as
the first script in the ScriptManager, like so:
Microsoft and the AjaxControlToolkit project managers tell me they want to fix this bug in the toolkit, so eventually this hack will (hopefully) no longer be necessary. But
in the meantime, this solution solves the problem with AjaxControlToolkit scripts not being loaded properly during partial updates.
My Signature: Mark a post as answered if it helped you, or don't, it makes no difference to me. Just PLEASE try not to use the word "random" when describing your problem.
taliesins
Member
20 Points
10 Posts
Compatibility patch for WebKit (Safari 3) 3.5.21022.8 MicrosoftAjax.debug.en-US.js
Apr 23, 2008 04:17 PM|LINK
Safari 3 is detected as Sys.Browser.Safari. There are specific hacks for Safari implemented in MicrosoftAjax.js. These hacks cause problems with Safari 3 as it uses a new javascript rendering engine called WebKit.
The hacks can cause dreaded errors like when updating a control's visibility from false to true in an updatepanel during a partial update. When that occurs it needs to download the supporting javascript to run the now visible server control. With the hacks in place it does not properly dynamically load the javascript file and it throws the following error:
Sys.ScriptLoadFailedException: The script 'http://localhost:2241/WebResource.axd?d=hvpXhV5kEMwLgAoaIglURevR_XTtDTBoKZ3aZWWaIvEkBXbLudri1AIv5bRs5f6licjCZMs3Z3MioQLqLTXV98582pKDHkD7BucGkKsPLz41&t=633444640020014740' failed to load. Check for:
Inaccessible path.
Script errors. (IE) Enable 'Display a notification about every script error' under advanced settings.
Missing call to Sys.Application.notifyScriptLoaded().
Now WebKit runs MicrosoftAjax.js without any problems. So I have modified the following to detect a new browser type called WebKit.
In the file called "MicrosoftAjax.debug.en-US.js" (do the same for the other cultures)
Change:
Sys.Browser = {};
Sys.Browser.InternetExplorer = {};
Sys.Browser.Firefox = {};
Sys.Browser.Safari = {};
Sys.Browser.Opera = {};
Sys.Browser.agent = null;
Sys.Browser.hasDebuggerStatement = false;
Sys.Browser.name = navigator.appName;
Sys.Browser.version = parseFloat(navigator.appVersion);
if (navigator.userAgent.indexOf(' MSIE ') > -1) {
Sys.Browser.agent = Sys.Browser.InternetExplorer;
Sys.Browser.version = parseFloat(navigator.userAgent.match(/MSIE (\d+\.\d+)/)[1]);
Sys.Browser.hasDebuggerStatement = true;
}
else if (navigator.userAgent.indexOf(' Firefox/') > -1) {
Sys.Browser.agent = Sys.Browser.Firefox;
Sys.Browser.version = parseFloat(navigator.userAgent.match(/ Firefox\/(\d+\.\d+)/)[1]);
Sys.Browser.name = 'Firefox';
Sys.Browser.hasDebuggerStatement = true;
}
else if (navigator.userAgent.indexOf(' Safari/') > -1) {
Sys.Browser.agent = Sys.Browser.Safari;
Sys.Browser.version = parseFloat(navigator.userAgent.match(/ Safari\/(\d+(\.\d+)?)/)[1]);
Sys.Browser.name = 'Safari';
}
else if (navigator.userAgent.indexOf('Opera/') > -1) {
Sys.Browser.agent = Sys.Browser.Opera;
}
To:
Sys.Browser = {};
Sys.Browser.InternetExplorer = {};
Sys.Browser.Firefox = {};
Sys.Browser.WebKit = {}; //Safari 3 is considered WebKit
Sys.Browser.Safari = {};
Sys.Browser.Opera = {};
Sys.Browser.agent = null;
Sys.Browser.hasDebuggerStatement = false;
Sys.Browser.name = navigator.appName;
Sys.Browser.version = parseFloat(navigator.appVersion);
if (navigator.userAgent.indexOf(' MSIE ') > -1) {
Sys.Browser.agent = Sys.Browser.InternetExplorer;
Sys.Browser.version = parseFloat(navigator.userAgent.match(/MSIE (\d+\.\d+)/)[1]);
Sys.Browser.hasDebuggerStatement = true;
}
else if (navigator.userAgent.indexOf(' Firefox/') > -1) {
Sys.Browser.agent = Sys.Browser.Firefox;
Sys.Browser.version = parseFloat(navigator.userAgent.match(/ Firefox\/(\d+\.\d+)/)[1]);
Sys.Browser.name = 'Firefox';
Sys.Browser.hasDebuggerStatement = true;
}
else 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';
}
else if (navigator.userAgent.indexOf(' Safari/') > -1) {
Sys.Browser.agent = Sys.Browser.Safari;
Sys.Browser.version = parseFloat(navigator.userAgent.match(/ Safari\/(\d+(\.\d+)?)/)[1]);
Sys.Browser.name = 'Safari';
}
else if (navigator.userAgent.indexOf('Opera/') > -1) {
Sys.Browser.agent = Sys.Browser.Opera;
}
kshakir
Member
2 Points
1 Post
Re: Compatibility patch for WebKit (Safari 3) 3.5.21022.8 MicrosoftAjax.debug.en-US.js
May 30, 2008 05:15 PM|LINK
Thank-you for your post! I was having the exact Safari 3 problem you mentioned, with ScriptLoadFailedException's during partial updates.
I used just this snippet in a ScriptReferenced .js, and it fixed the problem for my setup:
Sys.Browser.WebKit = {}; //Safari 3 is considered 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';
}
Is there a "more correct" way of removing the Safari hacks, instead of messing with the Sys.Browser object?
taliesins
Member
20 Points
10 Posts
Re: Compatibility patch for WebKit (Safari 3) 3.5.21022.8 MicrosoftAjax.debug.en-US.js
May 31, 2008 07:13 AM|LINK
The problem is that if we remove the Safari hacks then Safari 2 will stop working with AJAX. I guess it would be possible to go through all the .js files and find where each hack is and add a version check on top of the browser check.
Safari 3 is just a nice gui on top of WebKit. I like adding WebKit as a browser type as there are a number of other browsers that use WebKit at its core. This allows us to make WebKit specific "optimizations" if necessary and results in it being applied to all WebKit browsers.
http://trac.webkit.org/wiki/Applications%20using%20WebKit
Tali :>
staffordaz
Member
2 Points
1 Post
Re: Compatibility patch for WebKit (Safari 3) 3.5.21022.8 MicrosoftAjax.debug.en-US.js
Jun 18, 2008 03:59 PM|LINK
We are noticing the same problems using the ASP.NET 2.0 version of the Microsoft AJAX Library ("version 1.0" ???).
How can we change this in the built DLL (or override it)? All of the source code available for the library only includes the CS and JS files. There are no project files included in the download.
Thank you very much in advance.
-Arizona
franzkru
Member
2 Points
1 Post
Re: Compatibility patch for WebKit (Safari 3) 3.5.21022.8 MicrosoftAjax.debug.en-US.js
Jul 17, 2008 09:33 AM|LINK
Hi,
I'm using system.web.extension and i can rebuild it (there is no source code). So does any of you can rebuild dll with this fix ? Or tell me where can i found source code for this ?
Thanks in advance,
Rob
mehdi_mousavi
Member
22 Points
7 Posts
Re: Compatibility patch for WebKit (Safari 3) 3.5.21022.8 MicrosoftAjax.debug.en-US.js
Aug 10, 2008 12:41 PM|LINK
taliesins
Member
20 Points
10 Posts
Re: Compatibility patch for WebKit (Safari 3) 3.5.21022.8 MicrosoftAjax.debug.en-US.js
Aug 11, 2008 12:01 PM|LINK
How to apply patches to MicrosoftAjax.js
There are 2 possible ways of doing this. You can replace each script reference or you can set a path for all scripts. Note that it is important that the folder structure remains that same. It needs the namespace and version to calculate where the files are. Don't forget there are a couple of different versions. There is live and debug as well as culture specific files.
The scripts can be found at http://www.asp.net/ajax/downloads/
Script Reference Method:
If you use this method you need to get all the scripts in system.web.extensions and copy them
to ~/{Where you store you javascript files}.
taliesins
Member
20 Points
10 Posts
Re: Compatibility patch for WebKit (Safari 3) 3.5.21022.8 MicrosoftAjax.debug.en-US.js
Sep 05, 2008 10:27 AM|LINK
This patch will also allow Google Chrome browser to work MS Ajax as it is based on webkit. Google chrome uses webkit and has a compatible user agent, so it is detected as webkit.
Regards
Taliesin [:D]
danludwig
Contributor
3018 Points
601 Posts
Re: Compatibility patch for WebKit (Safari 3) 3.5.21022.8 MicrosoftAjax.debug.en-US.js
Jan 28, 2009 03:50 PM|LINK
I've experimented with this bug a lot, and the best temporary solution is the one proposed by kshakir (second post in this thread). Simply create a single JS file with his code and reference it in your site. To work properly, this script should be loaded before any AJAX control scripts. For my applications, I simply reference it as the first script in the ScriptManager, like so:
<asp:ScriptManager ID="ScriptManager1" runat="server"><Scripts>
<asp:ScriptReference Path="~/Scripts/Safari3AjaxHack.js" />
</Scripts>
</asp:ScriptManager>
The file can exist in any folder in your site, but as kshakir says, it should contain this code:
Sys.Browser.WebKit = {}; //Safari 3 is considered WebKitif( 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';
}
Microsoft and the AjaxControlToolkit project managers tell me they want to fix this bug in the toolkit, so eventually this hack will (hopefully) no longer be necessary. But in the meantime, this solution solves the problem with AjaxControlToolkit scripts not being loaded properly during partial updates.
jeff_b
Member
19 Points
20 Posts
Re: Compatibility patch for WebKit (Safari 3) 3.5.21022.8 MicrosoftAjax.debug.en-US.js
Mar 05, 2009 10:55 AM|LINK