两个不同版本的网站移动和桌面

时间:2013-01-10 06:05:20

标签: jquery iphone jquery-ui jquery-mobile mobile-browser

当我在网站和手机上进入ibm时 我看到两个不同的链接

http://www.ibm.com/us/en/

http://m.ibm.com/us/en/

iphone如何检测手机版?

http://m.ibm.com/us/en/

我正在研究我的项目做不同的网站,但不知道为iphone实现它,因为我不确定iphone如何重定向到m.ibm.com

<head><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"><meta content="public" name="Security"><meta content="IBM Corporation" name="DC.Publisher"><meta content="US" name="IBM.Country"><meta content="Joan Renner/Armonk/IBM" name="Owner"><meta content="2012-05-29" scheme="W3CDTF" name="IBM.Effective"><meta content="--" scheme="W3CDTF" name="IBM.Expires"><meta content="en-US" scheme="rfc1766" name="DC.Language"><meta content="2013-01-07" scheme="iso8601" name="DC.Date"><meta content="© Copyright IBM Corp. 2013, 2012" name="DC.Rights"><meta content="IBM101" scheme="IBM_SubjectTaxonomy" name="DC.Subject"><meta content="CT002" scheme="IBM_ContentClassTaxonomy" name="DC.Type"><meta content="" scheme="IBM_IndustryTaxonomy" name="IBM.Industry"><title>IBM - United States</title><link type="text/css" title="wireless" rel="stylesheet" media="all" href="//1.www.s81c.com/common/v17/css/mobile.css"><script type="text/javascript" src="//1.www.s81c.com/common/v17/mobile.js">//</script><script type="text/javascript" src="//1.www.s81c.com/common/js/dynamicnav/www/usen-utf8.js"></script><script type="text/javascript">window.onload = function() { ibmInit(); };</script><meta content="ibm.com wireless - Mobile Webmaster/Watson/IBM" name="Source"><meta content="noindex,nofollow" name="Robots"><meta name="viewport" content="user-scalable=no, initial-scale=1.0, maximum-scale=1.0, width=device-width"><meta name="apple-mobile-web-app-capable" content="yes"><link rel="alternate" type="text/html" title="Non Wireless" href="http://www.ibm.com/us/en/"><script type="text/javascript" src="chrome-extension://bfbmjmiodbnnpllbbbfblcplfjjepjdn/js/injected.js"></script></head>

2 个答案:

答案 0 :(得分:0)

使用javascript检测浏览器是否为iPhone,然后再重定向到新页面。

<script type="text/javascript">
    if(window.navigator.userAgent.indexOf("iPhone") > -1){
        document.location.href = "http:/m.ibm.com/us/en/";
    }
</script>

答案 1 :(得分:0)

希望此链接mobileesp可以帮助您。它有代码库,有几种流行的编程语言: PHP,Java,ASP.NET(C#),Python(用于Django)用于服务器端检测, JavaScript 用于更有限的客户端检测。