将用户重定向到网站的移动版本 [英] Redirect user to mobile version of site
本文介绍了将用户重定向到网站的移动版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何才能将使用旧设备的用户重定向到简化版(无CSS)的移动网站[m.site.com],并将新设备(如Iphone或Samsung Galaxy)重定向到更现代的版本? [sp.site.com]
How can i redirect users with older devices to a simplified (no css ) version of mobile site [ m.site.com ] , and newer devices like Iphone or Samsung Galaxy to a more modern one ? [sp.site.com ]
推荐答案
我建议使用特征检测.
测试较新设备"所需的功能,如果缺乏支持,请重定向到较旧的设备.
Test the features you need for the 'newer devices' and redirect to the older if there is a lack of support.
您可以使用 Modernizr
重定向很容易:
<script type="text/javascript">
<!--
window.location = "m.site.com"
//-->
</script>
这篇关于将用户重定向到网站的移动版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文