非常实用的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;
  document.write(typeof(navigator.platform)=="undefined"?"":navigator.platform)//输出对应的手机系统
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)的更多相关文章

  1. js判断手机端操作系统(Andorid/IOS),并自动为链接添加相应下载地址

    <script type="text/javascript"> $(document).ready(function(e) { var u = navigator.us ...

  2. JavaScript 判断手机端操作系统(Andorid/IOS)

    androidURL = "http://xxx/xxx.apk"; var browser = { versions: function() { var u = navigato ...

  3. js判断手机端操作系统的两种方法

    //判断手机端操作系统(Andorid/IOS),并自动跳转相应下载界面 androidURL ="http://xxx/xxx.apk"; var browser = { ver ...

  4. js判断手机端

    if (window.location.toString().indexOf('pref=padindex') != -1) { } else { if (/AppleWebKit.*Mobile/i ...

  5. 原生js判断手机端页面滚动停止

    var topValue = 0,// 上次滚动条到顶部的距离 interval = null;// 定时器 contactsList = document.getElementById(" ...

  6. JS判断手机端是否安装某应用

    方法一(网页上判断) if (navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)) {   var loadDateTime = new Date() ...

  7. js判断手机端Android手机还是iPhone手机

    /*判断当前设备是平板.安卓.苹果设备*/ <script type="text/javascript"> function fBrowserRedirect(){ v ...

  8. js判断手机端和pc端

    var browser = { versions: function() { var u = navigator.userAgent, app = navigator.appVersion; retu ...

  9. js判断手机端(Android手机还是iPhone手机)

    /** * [isMobile 判断平台] * @param test: 0:iPhone 1:Android */ function ismobile(test){ var u = navigato ...

随机推荐

  1. Super Phyllis(穷举+搜索)

    http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2723 题意:给出一些字符串u,v,代表u-&g ...

  2. 利用if else 求房贷

    static void Main(string[] args)        {            while (true)     //主要就是公式的运用和if else 的嵌套         ...

  3. 【Node】fs

    var fs = require('fs') // fs 文件系统 var stdin = process.stdin var stdout = process.stdout var stats = ...

  4. android学习—— LayoutInflater的使用

    在实际开发种LayoutInflater这个类还是非常有用的,它的作用类似于findViewById(),不同点是LayoutInflater是 用来找layout下xml布局文件,并且实例化!而fi ...

  5. Delphi-idHttp-JSON用法

    从国外网站抄来的代码 Delphi source: http := TIdHttp.Create(nil);http.HandleRedirects := True;//允许头转向http.ReadT ...

  6. 字符串编码、Base64字符串 互转

    /// <summary>  /// 将字符串编码为Base64字符串  /// </summary>  /// <param name="str"& ...

  7. 用户home目录下的.gitconfig 和 库文件夹目录下的 .gitignore 示例

    .gitconfig文件: [user] name = hzh email = @qq.com [core] editor = vi quotepath = false [merge] tool = ...

  8. Eclipse插件收藏列表

    viPlugin 2.11.0 AnyEdit Tools 2.4.4 EclipseColorer 0.8.0 PyDev – Python IDE for Eclipse 2.7.5 MoreUn ...

  9. SparkContext的初始化过程分析(源码)

     SparkContext的构造函数中,最重要的入参是SparkConf  根据初始化入参生成SparkConf 再根据SparkConf来创建SparkEnv TaskScheduler.start ...

  10. Yii中Ajax的使用,如收藏功能

    view中 <?php $cs=Yii::app()->clientScript; $cs->registerScriptFile('http://ajax.googleapis.c ...