I have an ASP.NET application that uses ASP.NET AJAX and the AJAX Control Toolkit. The application runs fine on all recent browsers on a PC. It also works fine on my iPad, at least the first time the application is accessed. I have found that if I shut down the iPad and return to the page later (via a bookmark or similar), the site is broken. I have narrowed down the failure to an ASP.NET/ASP.NET AJAX issue/bug/limitation, and I'm looking for some help to progress.
Using Fiddler as a proxy server for the iPad, I have identified the following problems, when re-opening the page.
Somehow, it appears the framework decides that it isn't doesn't need these scripts and doesn't emit them. Given all the scripts are interrelated, there must be a common reason. This may be related to the reason that the *.skin properties are not included. Any ideas? I would have thought about browser capabilities, but this only happens on subsequent visits to the site, not the first.
Edit: Definitely looking like a browser capability issue.
Requests that work: User-Agent: Mozilla/5.0 (iPad; U; CPU OS 4_3_3 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2
Requests that don't: User-Agent: Mozilla/5.0 (iPad; U; CPU OS 4_3_3 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Mobile/8J2
Will attempt creating a custom file in App_Browsers and post back with extra info.
The root issue is indeed ASP.NET recognizes the iPad as a generic downlevel 'Mozilla' instead of Safari, when the application is loaded in full screen mode. It thinks JavaScript is not supported, etc.
The solution is adding the following to all of your ASP.NET pages (by adding this to the base page all your ASP.NET pages derive from).
protected void Page_PreInit(object sender, EventArgs e)
{
if (Request.UserAgent != null && Request.UserAgent.IndexOf("AppleWebKit", StringComparison.CurrentCultureIgnoreCase) > -1)
{
this.ClientTarget = "uplevel";
}
}
(I tried creating a single *.browser file but failed miserably as it doesn't appear I can reference the framework's *.browser files from within my own.)
I usually do this in global.asax
void Application_BeginRequest(Object sender, EventArgs e)
{
Request.Browser.Adapters.Clear();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With