views:

1758

answers:

1

Here's the background info first. ASP.NET 2.0 Web Site with AJAX Extensions 1.0.

I have a weird issue that only occurs in Safari and I can only assume Chrome as well since they both use WebKit. I also use jQuery in the site, but currently the reference to jQuery is only loaded on one page so I don't think this is the issue.

I have a friendly "Processing Request..." message that appears when you submit a page async or non-async postback) and hides after postback. In the case of the async postback, I use the PageRequestManager's add_endRequest(...) method to hide the "Processing Request..." message. This works great in FireFox, IE 6/7/8 and Opera but for some reason on Safari (Windows and Mac versions), the add_endRequest(...) does not always fire. I'm all about the cross browser so just wondering if anyone has any ideas on how to fix this.

This is a show stopper for me because not only does the "Processing Request..." message appear, but I also put a transparent div on top of the entire page to prevent multiple clicks after submitting, so the page becomes unusable unless you know how to hack the CSS to hide the transparent div.

Here's the code snippet from my master page's markup of what I do to handle my "Processing Request..." message:

<asp:ScriptManager ID="ScriptManager1" runat="server" />
<script type="text/javascript" src="<%= ResolveClientUrl("~/Script/aspNetAjaxFix.js") %>"></script>
<script type="text/javascript" >
(function() {
    var processingID = "<%=processing.ClientID%>"
    var prm = Sys.WebForms.PageRequestManager.getInstance();

    if (prm)
    {
        prm.add_endRequest(
        function (sender, args) {
            //alert('Fired!')
            if (top['showAsyncProcessingWindow'])
            {
                setTimeout(function(){document.getElementById(processingID).className="LockOff";document.getElementById('processMe').className='processMeLockOff';if(typeof(showIE6Selects)!="undefined"){showIE6Selects();}}, 1000);
                top['showAsyncProcessingWindow'] = false;
            }

            if(args.get_error() && args.get_error().name === 'Sys.WebForms.PageRequestManagerServerErrorException')
            {
                args.set_errorHandled(args._error.httpStatusCode == 0);
            }
        });
    }
})();
</script>

And if you're wondering what aspNetAjaxFix.js is, see this question I posted on StackOverFlow, http://stackoverflow.com/questions/757758/internet-explorers-operation-aborted-and-latency-issue

I also Googled this of course with not much luck. This article seemed to be relevant ,http://forums.asp.net/t/1247957.aspx but only asks the same question, no solution.

Any insight into this issue would be greatly appreciated.

+4  A: 

Well after some more digging, I found out the issue. It has nothing to do with the PageRequestManager's add_endRequest(...) method and everything to do with Browser detection in the ASP.NET AJAX client-side API for Safari and WebKit based browsers.

Thanks to this post from taliesins on the ASP.NET forums, http://forums.asp.net/t/1252014.aspx. I found this post by first seeing that I was getting this error:

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

even though I was calling Sys.Application.notifyScriptLoaded() in my JavaScript.

Show stopper resolved.

nickyt