0

当我在网站和移动设备中进入 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>
4

2 回答 2

0

使用 javascript 来检测浏览器是否是 iPhone,如果是,则重定向到新页面。

<script type="text/javascript">
    if(window.navigator.userAgent.indexOf("iPhone") > -1){
        document.location.href = "http:/m.ibm.com/us/en/";
    }
</script>
于 2013-01-10T06:12:58.047 回答
0

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

于 2013-01-10T06:17:44.537 回答