查看完整的网站,而不是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.