开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜