PC Review


Reply
Thread Tools Rate Thread

AJAX Page Loading Failure on Some Browsers

 
 
Jacques Oberto
Guest
Posts: n/a
 
      21st Oct 2009
Hi All,

Depending on the browser used (all latest versions), I am
experiencing various degrees of failure in showing processing
progress with a simple AJAX wait while loading" asp.net app.

The app has two pages: Default.aspx (showing the progress)
and a Process.aspx sleepy page doing some processing.

Results (Vista SP2 & XP SP3):
--IE8: works correctly only if DynamicLayout="False"
--Safari4: works fine
--Firefox3.5.3: spinning gif starts spinning then stops
--Chrome3.0.195.27: works fine
--Opera10: Fails miserably, no progresstemplate is shown at all

I have been testing about a dozen similar projects from the
web with the same results. I would be very pleased is someone
could tell me what I am doing wrong.
Thanks,

Jacques



Demo code follows:

============
Default.aspx
============
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>UpdateProgress control</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdateProgress runat="server" id="PageUpdateProgress"
EnableViewState="True" DynamicLayout="False">
<ProgressTemplate>
<div>
Loading...
<asp:Image ID="LoadingImage" runat="server"
ImageUrl="~/loading.gif" />
</div>
</ProgressTemplate>
</asp:UpdateProgress>
<asp:UpdatePanel runat="server" id="Panel">
<ContentTemplate>
<asp:Button runat="server" id="UpdateButton"
onclick="UpdateButton_Click" text="Update" />
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
</html>


===============
Default.aspx.cs
===============
....
protected void UpdateButton_Click(object sender, EventArgs e)
{
Response.Redirect("Progress.aspx");
}


================
Progress.aspx.cs
================
....
protected void Page_Load(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(5000);
}

 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      22nd Oct 2009
your test is wrong.

the updateprogress control is designed to run during an async (ajax)
postback. the postback is returning right away with a redirect commend.
the ajax code receives this, and sets the document.location to the new
url (to do the redirect).

at this point all bets are off, the browser is now navigating to a new
page (that takes 5 seconds to respond). during navigation many browsers
will stop the background thread that runs animated gifs, may ignore dom
updates, etc. there is no defined behavior during this phase.

if you are doing this on your local box, the redirect response may come
before the progress bar even has chance to start.


-- bruce (sqlwork.com)




Jacques Oberto wrote:
> Hi All,
>
> Depending on the browser used (all latest versions), I am
> experiencing various degrees of failure in showing processing
> progress with a simple AJAX wait while loading" asp.net app.
>
> The app has two pages: Default.aspx (showing the progress)
> and a Process.aspx sleepy page doing some processing.
>
> Results (Vista SP2 & XP SP3):
> --IE8: works correctly only if DynamicLayout="False"
> --Safari4: works fine
> --Firefox3.5.3: spinning gif starts spinning then stops
> --Chrome3.0.195.27: works fine
> --Opera10: Fails miserably, no progresstemplate is shown at all
>
> I have been testing about a dozen similar projects from the
> web with the same results. I would be very pleased is someone
> could tell me what I am doing wrong.
> Thanks,
>
> Jacques
>
>
>
> Demo code follows:
>
> ============
> Default.aspx
> ============
> <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
> Inherits="_Default" %>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
> "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head id="Head1" runat="server">
> <title>UpdateProgress control</title>
> </head>
> <body>
> <form id="form1" runat="server">
> <asp:ScriptManager ID="ScriptManager1" runat="server" />
> <asp:UpdateProgress runat="server" id="PageUpdateProgress"
> EnableViewState="True" DynamicLayout="False">
> <ProgressTemplate>
> <div>
> Loading...
> <asp:Image ID="LoadingImage" runat="server"
> ImageUrl="~/loading.gif" />
> </div>
> </ProgressTemplate>
> </asp:UpdateProgress>
> <asp:UpdatePanel runat="server" id="Panel">
> <ContentTemplate>
> <asp:Button runat="server" id="UpdateButton"
> onclick="UpdateButton_Click" text="Update" />
> </ContentTemplate>
> </asp:UpdatePanel>
> </form>
> </body>
> </html>
>
>
> ===============
> Default.aspx.cs
> ===============
> ...
> protected void UpdateButton_Click(object sender, EventArgs e)
> {
> Response.Redirect("Progress.aspx");
> }
>
>
> ================
> Progress.aspx.cs
> ================
> ...
> protected void Page_Load(object sender, EventArgs e)
> {
> System.Threading.Thread.Sleep(5000);
> }

 
Reply With Quote
 
Jacques Oberto
Guest
Posts: n/a
 
      22nd Oct 2009
> during navigation many browsers will stop the background thread that runs
> animated gifs, may ignore dom updates, etc. there is no defined behavior
> during this phase.


Hi Bruce,

Thanks for the explanation: I get it now.
It is a bit scary that a wrong logic works perfectly in some browsers.
This is certainly not helping newbie developers.

Jacques


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.NET 2.0 / 3.5 / AJAX support for browsers other than IE VR@MSDN.COM Microsoft ASP .NET 6 19th Dec 2007 10:03 PM
Web browsers not loading =?Utf-8?B?S2VycmFuY2U=?= Windows Vista Networking 3 14th Mar 2007 11:45 PM
AJAX/ATLAS: Errors after you click the browsers back button Darren.Ratcliffe@gmail.com Microsoft ASP .NET 0 17th Nov 2006 03:01 PM
Ads Not Loading In Browsers Keith Russell Windows XP Help 6 1st Feb 2006 10:33 PM
my browsers are way too slow loading pages. =?Utf-8?B?T3NjYXI=?= Windows XP Performance 3 20th Oct 2004 03:16 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:01 AM.