如果从手机或PC开放,如何重定向网站..? [英] how to redirect a website, if open from mobile or PC..?

查看:103
本文介绍了如果从手机或PC开放,如何重定向网站..?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我创建了2个网站。 1 GT;对于电脑。和1>移动设备。



如果有人从移动设备开放,如何重定向网站。它应该打开一个移动网站。



和有人从PC打开。它应该打开一个PC的网站。



请帮助。

Hi,

i have created 2 websites. 1> for pc. and 1> for mobile.

how to redirect a website if someone open from mobile devise. it should open a website of mobile.

and someone open from PC. it should open a website of PC.

Please Help.

推荐答案

您可以查看请求。 Browser.IsMobileDevice属性: MSDN [ ^ ]应该这样做,但我不会这样做 - 有时候你想要在PC上使用移动版本(以减少废话并获得网页的内容),有时你想要在手机上使用PC版本(因为信息不是在移动版本上不容易或明显可用)



这个网站的方式很好 - 底部有一个移动链接让我覆盖它,并在移动页面顶部的完整站点链接返回到PC。也许,如果您检测到手机并询问他们喜欢哪种手机,并将结果存储在Cookie中?
You can check the Request.Browser.IsMobileDevice property: MSDN[^] which should do it, but I wouldn''t just do it - sometimes you want a mobile version on a PC (to cut out the crap and get to the meat of the webpage) and sometimes you want a PC version on your mobile (because the info isn''t easily or obviously available on the mobile version)

The way this site does it is nice - there is a "mobile" link at the bottom which lets me override it, and a "Full Site" link at teh top of the mobile page to get back to PC. Perhaps, if you detect a mobile and ask which they prefer, and store the result in a cookie?


这篇关于如果从手机或PC开放,如何重定向网站..?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆