开发者

Redirect to Mobile site?

开发者 https://www.devze.com 2023-02-25 04:43 出处:网络
When the user join my site.. if they u开发者_如何学编程se mobile.. I want to redirect to the 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

精彩评论

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