Compatibility patch for WebKit (Safari 3) 3.5.21022.8 MicrosoftAjax.debug.en-US.js

Last post 06-18-2008 11:59 AM by staffordaz. 3 replies.

Sort Posts:

  • Compatibility patch for WebKit (Safari 3) 3.5.21022.8 MicrosoftAjax.debug.en-US.js

    04-23-2008, 12:17 PM
    • Loading...
    • taliesins
    • Joined on 04-14-2008, 2:03 PM
    • Posts 3

    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;
    }

  • Re: Compatibility patch for WebKit (Safari 3) 3.5.21022.8 MicrosoftAjax.debug.en-US.js

    05-30-2008, 1:15 PM
    • Loading...
    • kshakir
    • Joined on 05-30-2008, 5:02 PM
    • Posts 1

    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?

  • Re: Compatibility patch for WebKit (Safari 3) 3.5.21022.8 MicrosoftAjax.debug.en-US.js

    05-31-2008, 3:13 AM
    • Loading...
    • taliesins
    • Joined on 04-14-2008, 2:03 PM
    • Posts 3

    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 :>

  • Re: Compatibility patch for WebKit (Safari 3) 3.5.21022.8 MicrosoftAjax.debug.en-US.js

    06-18-2008, 11:59 AM
    • Loading...
    • staffordaz
    • Joined on 05-22-2007, 10:34 PM
    • Posts 1

    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

     

Page 1 of 1 (4 items)