Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Chrome ajax async postback end does not work

I have a sample app developed in asp.NET 3.5. On my master page I use following code to display an GIF while loading the page. It works correctly on IE and FF, but fails in Chrome. On pressing the submit button, the server gets the request and completes its processing and while that is happening the browser shows the loading GIF as expected.However the postback never completes and user keeps on looking at the progress GIF. I wonder where I have goofed up... Pls help!

                             // Get the instance of PageRequestManager.
                             var prm = Sys.WebForms.PageRequestManager.getInstance();
                             // Add initializeRequest and endRequest
                             prm.add_initializeRequest(prm_InitializeRequest);
                             prm.add_endRequest(prm_EndRequest);
                             // Called when async postback begins
                             function prm_InitializeRequest(sender, args) {
                                 // get the divImage and set it to visible
                                 var panelProg = $get('divImage');  
                                 if( panelProg != null)             
                                 {
                                    panelProg.style.display = '';
                                     // Disable button that caused a postback
                                     $get(args._postBackElement.id).disabled = true;
                                 }
                             }
                             // Called when async postback ends
                             function prm_EndRequest(sender, args) {
                                 // get the divImage and hide it again
                                 var panelProg = $get('divImage'); 
                                 if(panelProg != null)
                                 {               
                                    panelProg.style.display = 'none';
                                    $get(sender._postBackSettings.sourceElement.id).disabled = false;

                                 }
                             }

My divImage is simple

  <div id="divImage" style="display: none">

        <img id="imgId1" src="../../App_Themes/Images/progressbar.gif" style="border-width:0px;" />
        <br />
        Please wait...

    </div>
like image 761
gbipin Avatar asked Oct 14 '22 21:10

gbipin


1 Answers

Add the following script to your page.

<script type="text/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';
    }
</script>

See more at: http://blog.joeydaly.com/uncaught-sys-scriptloadfailedexception-sys-scriptloadfailedexception

like image 161
Alexandre N. Avatar answered Oct 16 '22 15:10

Alexandre N.