查看完整的网站,而不是iPhone上的移动版本 [英] View full website, not mobile version on iPhone

查看:135
本文介绍了查看完整的网站,而不是iPhone上的移动版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个脚本可以检测您是否是iPhone用户,并重定向到更友好的iPhone页面。

I have a script that detects whether you're an iPhone user or not and redirects to a more iPhone friendly page.

<script  type="text/javascript">
    if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) 
    {
        location.replace("http://domain.com/iphone/");
    }
</script> 

这很好但有一个问题。通常,为用户提供查看完整网页的功能。但是,如果我链接到根,显然重定向将发送到移动版本!

This works great but has one problem. It is convention to offer the user the ability to view the full web page. However, if I link to the root, obviously the redirect is going to send them to the mobile version!

如果点击链接从 / iphone / ,他们可以去 / 并留在那里。

Any ideas on how to include if click on the link from /iphone/, they can go to / and stay there.

推荐答案

查询字符串是要走的路(正如其他人所说的那样)。看看Facebook,如果你点击移动网站上的完整网站链接,它会重定向到www.facebook.com/login.php?m2w - m2w可能是MobileToWeb,这将阻止网站将用户重定向到移动网站。

The Query String is the way to go ( as the others have said above). Looking at Facebook, if you click on the 'full site' link on the mobile site, it redirects to www.facebook.com/login.php?m2w - the m2w is probably MobileToWeb and this will prevent the site redirecting the user to the mobile site.

这篇关于查看完整的网站,而不是iPhone上的移动版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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