PsyGnosis
PsyGnosis

Reputation: 1499

Redirect to Mobile site?

When the user join my site.. if they use mobile.. I want to redirect to the mobile site..

How can I do that with javascript or .net?

Upvotes: 0

Views: 459

Answers (2)

Joe Hanink
Joe Hanink

Reputation: 4857

Typically, you'd compile a list of user-agent strings for mobile browsers and extract which patterns you want to handle. Then in your server code, send a 302 response header OR issue a page with a META refresh to your mobile URL.

Upvotes: 0

Anand Thangappan
Anand Thangappan

Reputation: 3106

Put this on your page load:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

If Request.Browser("IsMobileDevice") = "True" Then
Response.Redirect("put url here", True)

End If

End Sub

Hope this will help.

Upvotes: 3

Related Questions