It's quite useful piece of code-behind, which redirects to a mobile version of the site.
Please use and modify for your needs. This routine is being written in VB.NET
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim strUserAgent As String
Dim flag As String
flag = "0"
strUserAgent = Request.UserAgent.ToString().ToLower()
If (strUserAgent.Contains("iphone")) Then flag = "1"
If (strUserAgent.Contains("blackberry")) Then flag = "1"
If (strUserAgent.Contains("mobile")) Then flag = "1"
If (strUserAgent.Contains("windows ce")) Then flag = "1"
If (strUserAgent.Contains("opera mini")) Then flag = "1"
If (strUserAgent.Contains("palm")) Then flag = "1"
If (strUserAgent.Contains("android")) Then flag = "1"
If (strUserAgent.Length <> 0) Then
If (Request.Browser.IsMobileDevice = "True" And flag = "1") Then
Response.Redirect("http://www.test1.org")
End If
End If
End Sub
Thursday, December 8, 2011
Wednesday, December 7, 2011
First Mobile Web site
It took 2 weeks to finish my first mobile website. It was quite interesting journey. First of all, jQuery Mobile is a new Javascript library and I was interested to implement it for new mobile site.
I discovered that current version of jQueryMobile does fully support with AJAX extensions all mobile platforms except Blackberry 5.
I had a problem with iPhone view. There is a quite good fix, which must be place in a head of the page to bring a picture to the stable condition on all mobile platforms:
<meta name="viewport" content="width=device-width, initial-scale=1">
I discovered that current version of jQueryMobile does fully support with AJAX extensions all mobile platforms except Blackberry 5.
I had a problem with iPhone view. There is a quite good fix, which must be place in a head of the page to bring a picture to the stable condition on all mobile platforms:
<meta name="viewport" content="width=device-width, initial-scale=1">
Subscribe to:
Posts (Atom)