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 ...
随机推荐
- 【CF】222 Div.1 B Preparing for the Contest
这样类似的题目不少,很多都是一堆优化条件求最优解,这个题的策略就是二分+贪心.对时间二分, 对费用采用贪心. /* 377B */ #include <iostream> #include ...
- Python爬虫处理抓取数据中文乱码问题
乱码原因:因为你的文件声明为utf-8,并且也应该是用utf-8的编码保存的源文件.但是windows的本地默认编码是cp936,也就是gbk编码,所以在控制台直接打印utf-8的字符串当然是乱码了. ...
- java httpclient post 文件到server
public void sendFileToServer (String url, File logFiles) { HttpURLConnection connection = nul ...
- POJ_3579_Median_(二分,查找第k大的值)
描述 http://poj.org/problem?id=3579 给你一串数,共C(n,2)个差值(绝对值),求差值从大到小排序的中值,偶数向下取. Median Time Limit: 1000M ...
- Lua运算符
+ 加- 减* 乘/ 除^ 幂% 求余# 求长度= 赋值< 小于> 大于== 等于<= 不大于=> 不小于~= 不等于and 逻辑与or 逻辑或not 逻辑非.. 连接字符串
- Remarks on a preprint
Page 2 Line 1, "reads" should be "read". Page 2 Line 5, "are initial veloci ...
- 如何实现批处理文件传参数给SQLPLUS
原文地址:http://www.cnblogs.com/HondaHsu/archive/2012/11/23/2784094.html 第一:批处理文件drop_table.bat 说明: 批处理中 ...
- tomcat web容器中,调用jersey client端报错的处理
在web工程中,写main方法,运行ok. 发布到tomcat中后,报错. javax.ws.rs.core.UriBuilder.uri(Ljava/lang/String;)Ljavax/ws/r ...
- HDOJ/HDU Tempter of the Bone(深搜+奇偶性剪枝)
Problem Description The doggie found a bone in an ancient maze, which fascinated him a lot. However, ...
- C语言中的宏
写好C语言,漂亮的宏定义很重要,使用宏定义可以防止出错,提高可移植性,可读性,方便性 等等.下面列举一些成熟软件中常用得宏定义...... 1,防止一个头文件被重复包含 #ifndef COMDEF_ ...