js判断手机端操作系统(Andorid/IOS)
非常实用的js判断手机端操作系统(Andorid/IOS),并自动跳转相应下载界面
androidURL = "http://xxx/xxx.apk"; var browser = {
versions: function() {
var u = navigator.userAgent,
app = navigator.appVersion;
return { android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, iPhone: u.indexOf('iPhone') > -1 , iPad: u.indexOf('iPad') > -1,
iPod: u.indexOf('iPod') > -1, };
} (),
language: (navigator.browserLanguage || navigator.language).toLowerCase()
}
if (browser.versions.iPhone||browser.versions.iPad||browser.versions.iPod)
{
//如果是ios系統,直接跳轉至appstore該應用首頁,傳遞参數为該應用在appstroe的id號
window.location.href="itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=123456";
}
else if(browser.versions.android)
{
window.location.href = androidURL;
}
转载请注明(B5教程网)原文链接:http://www.bcty365.com/content-69-1807-1.html
第二种方案:
<script language="javascript">
window.onload = function () {
alert("1");
var u = navigator.userAgent;
if (u.indexOf('Android') > -1 || u.indexOf('Linux') > -1) {//安卓手机
alert("安卓手机");
// window.location.href = "mobile/index.html";
} else if (u.indexOf('iPhone') > -1) {//苹果手机
// window.location.href = "mobile/index.html";
alert("苹果手机");
} else if (u.indexOf('Windows Phone') > -1) {//winphone手机
alert("winphone手机");
// window.location.href = "mobile/index.html";
}
}
</script>
原文地址:http://www.cnblogs.com/lyl6796910/p/3700151.html
js判断手机端操作系统(Andorid/IOS)的更多相关文章
- js判断手机端操作系统(Andorid/IOS),并自动为链接添加相应下载地址
<script type="text/javascript"> $(document).ready(function(e) { var u = navigator.us ...
- JavaScript 判断手机端操作系统(Andorid/IOS)
androidURL = "http://xxx/xxx.apk"; var browser = { versions: function() { var u = navigato ...
- js判断手机端操作系统的两种方法
//判断手机端操作系统(Andorid/IOS),并自动跳转相应下载界面 androidURL ="http://xxx/xxx.apk"; var browser = { ver ...
- js判断手机端
if (window.location.toString().indexOf('pref=padindex') != -1) { } else { if (/AppleWebKit.*Mobile/i ...
- 原生js判断手机端页面滚动停止
var topValue = 0,// 上次滚动条到顶部的距离 interval = null;// 定时器 contactsList = document.getElementById(" ...
- JS判断手机端是否安装某应用
方法一(网页上判断) if (navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)) { var loadDateTime = new Date() ...
- js判断手机端Android手机还是iPhone手机
/*判断当前设备是平板.安卓.苹果设备*/ <script type="text/javascript"> function fBrowserRedirect(){ v ...
- js判断手机端和pc端
var browser = { versions: function() { var u = navigator.userAgent, app = navigator.appVersion; retu ...
- js判断手机端(Android手机还是iPhone手机)
/** * [isMobile 判断平台] * @param test: 0:iPhone 1:Android */ function ismobile(test){ var u = navigato ...
随机推荐
- 一起啃PRML - 1.1 Example: Polynomial Curve Fitting 多项式曲线拟合
一起啃PRML - 1.1 Example: Polynomial Curve Fitting @copyright 转载请注明出处 http://www.cnblogs.com/chxer/ 前言: ...
- POJ_2385_Apple_Catching_(动态规划)
描述 http://poj.org/problem?id=2385 两棵苹果树,给定一个时间t,1~t每分钟有一棵树掉苹果,牛起始在#1树,最多换w次位置,问最多接到多少苹果. Apple Catch ...
- BZOJ1831: [AHOI2008]逆序对
1831: [AHOI2008]逆序对 Time Limit: 10 Sec Memory Limit: 64 MBSubmit: 341 Solved: 226[Submit][Status] ...
- 在 SharePoint 2010 中访问数据
转:http://blog.banysky.net/?p=81001 数据访问的关键方法有哪些? | 使用查询类 | 使用 SPQuery | 使用 SPSiteDataQuery | 使用 LINQ ...
- [C#]网络编程系列专题二:HTTP协议详解
转自:http://www.cnblogs.com/zhili/archive/2012/08/18/2634475.html 我们在用Asp.net技术开发Web应用程序后,当用户在浏览器输入一个网 ...
- Java基础—异常处理总结
异常处理是程序设计中一个非常重要的方面,也是程序设计的一大难点,从C开始,你也许已经知道如何用if...else...来控制异常了,也许是自发的,然而这种控制异常痛苦,同一个异常或者错误如果多个地 ...
- C#后台执行bat
C#后台执行bat ProcessStartInfo p = new ProcessStartInfo(); p.FileName = "C:\\1.bat"; p.WindowS ...
- webdriver 操作 Firefox 在关闭浏览器时弹出 “Plugin Container for Firefox已停止工作” 处理办法。
上来先来一个图: 在使用webdriver操作Firefox浏览器的时候,一路顺畅.可是在最后关闭浏览器后,出现了如上面图示的警告!这个警告很早就出现了,因为也不影响测试结果,也就一直没理. 后来新搭 ...
- Kbuild文件
3 Kbuild文件 大部分内核中的Makefile都是使用Kbuild组织结构的Kbuild Makefile.这章将介绍Kbuild Makefile的语法. 对于Kbuild文件名来讲,Kbui ...
- phpDesigner 7.2.5 注册码 更改 语法高亮 主题
注册码: 用户名:www.xiazaiba.com 序列号:43AB0D432A29EE238CCE0F884D84D8A18498498E98298A98568AD05A0B40 验证码:7S2FF ...