Cannot read property '_notified' of null with ASP.NET Ajax with WebKit based browsers


JavaScript Error:

"Cannot read property '_notified' of null"

If you receive this error, you’re probably using ASP.NET Ajax (in my case, 3.5) and a browser that ASP.NET Ajax doesn’t recognize. In my case, it is WebKit based browsers like Safari and Chrome. Once this JavaScript error is thrown all subsequent events on the page stop working. After researching, I found a fix to my problem on this blog and I’m going to repost it for posterity in case it disappears. Here is a link to the original blog post that helped me: http://blog.lavablast.com/post/2008/10/20/Gotcha-WebKit-(Safari-3-and-Google-Chrome)-Bug-with-ASPNET-AJAX.aspx

The Fix:

Create a new javascript file and place it in your web-site, I choose “WebKit.js”. The contents of this file should be:

JavaScript

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

Now, on any page where you’re using a script manager you’ll need to put a script reference in to this file. This can be placed in a ScriptManager, an ToolkitScriptManager OR in a ScriptManagerProxy if it’s being used from a user control:

ASP.Net Markup

        <asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server"> 
            <Scripts>
                <%-- Used to fix problem with ASP.NET Ajax breaking in Chrome/Safari/WebKit --%>
                <asp:ScriptReference Path="/Main/JavaScript/WebKit.js" />
            </Scripts>
        </asp:ScriptManagerProxy>