Solve MS Ajax Script loading error in Safari & Chrome

Safari 3x and Google Chrome uses javascript engine called WebKit and which causes error similar to

Sys.ScriptLoadFailedException: The script 'http://localhost:2241/WebResource.axd?d=hvpXhV5kE...........' 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().

This is because in MicrosoftAjax.js file webkit is not defiened in the list of supported browser and which will cause exception while loading the script in browser.

To overcome this issue

  1. Create a javascript file with any name
  2. Put code below in it
    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'; 
    }
  3. In the code of your page put following
    <asp:ScriptManager ID="ScriptManager" runat="server" >
    <Scripts>
    <asp:ScriptReference Path="~/PATH TO YOUR SCRIPT" />
    </Scripts>
    </asp:ScriptManager>

This is using feature called script merge and adds new browser detection code in javascript of Microsoft Ajax.

This will fix the issue.

More information, click here

Prakash Software Solutions PVT LTD. Offer wide range of services to their clients all over the globe. We successfully delivered projects i.e. software development, cloud computing solutions, SharePoint development solutions, mobile app development and Microsoft technology solution to our Sweden, Denmark, Netherlands, France, Norway, Germany, Spain, Italy, Switzerland, Belgium, Luxembourg, Ireland, United Kingdom, United States, Canada, Brazil, Peru, UAE, Dubai, Saudi Arabia, Kuwait, Qatar, Bahrain, Singapore, New Zealand and Australia Clients.

Leave a reply