Redirect to Mobile site?
When the user join my site.. if they u开发者_如何学编程se mobile.. I want to redirect to the mobile site..
How can I do that with javascript or .net?
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.
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.
精彩评论