So, just when thought it was safe to go back in the water. Having posted about auto detecting iPhones, hitting your mobile web-pages, I needed to also allow for the iPod Touch.
So this is my updated default web-page that will automatically redirect to appropriate web pages for desktop browser. iPod, iPhone and any Windows Mobile device. The source for my default.aspx page is as follows -
<%@ Page Language="C#" Trace="false" %>
<SCRIPT LANGUAGE="C#" RUNAT=SERVER>
protected void Page_Load(Object sender, EventArgs e) { System.Web.Mobile.MobileCapabilities cur = (System.Web.Mobile.MobileCapabilities) Request.Browser;
// this block of code is to detect if users are running Pocket PC 2003/CE or iPhone bool isce=false; bool isiphone=false; bool isipod=false;
try { isce = (Request.UserAgent.IndexOf("Windows CE")!=-1); isiphone = (Request.UserAgent.IndexOf("iPhone;")!=-1); isipod = (Request.UserAgent.IndexOf("iPod;")!=-1); } catch {
} if (cur.IsMobileDevice||isce||isiphone||isipod) { Response.Redirect("mobile"); } else { Response.Redirect("main"); } }
</SCRIPT>
Theme design by Jelle Druyts
Pick a theme: BlogXP calmBlue
My Virtual Earth Balloon Races www.racingballoon.com Richard JonesPowered By The Fridge Server