Chinaunix首页 | 论坛 | 博客
  • 博客访问: 953167
  • 博文数量: 80
  • 博客积分: 2380
  • 博客等级: 大尉
  • 技术积分: 1049
  • 用 户 组: 普通用户
  • 注册时间: 2010-04-14 11:06
个人简介

Only to find a successful way, not to find excuses for failure!

文章分类

全部博文(80)

文章存档

2016年(2)

2015年(4)

2014年(10)

2013年(10)

2012年(7)

2011年(17)

2010年(30)

分类: JavaScript

2015-05-18 12:15:04


点击(此处)折叠或打开

  1. or_app.html

  2. <!DOCTYPE HTML>
  3. <html lang="zh-CN">
  4. <head>
  5.     <meta charset="UTF-8">
  6.     <title>偶然-陌生人交友,手机APP下载页</title>
  7.     <script type="text/javascript">
  8.         // 获取终端的相关信息
  9.          /*
  10.              * 智能机浏览器版本信息:
  11.              *
  12.              */
  13.             var browser = {
  14.                 versions: function() {
  15.                     var u = navigator.userAgent + navigator.appVersion;
  16.                     return {//移动终端浏览器版本信息
  17.                         trident: u.indexOf('Trident') > -1, //IE内核
  18.                         presto: u.indexOf('Presto') > -1, //opera内核
  19.                         webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
  20.                         gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, //火狐内核
  21.                         mobile: !!u.match(/AppleWebKit.*Mobile.*/) || !!u.match(/AppleWebKit/), //是否为移动终端
  22.                         ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
  23.                         android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或者uc浏览器
  24.                         iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, //是否为iPhone或者QQHD浏览器
  25.                         iPad: u.indexOf('iPad') > -1, //是否iPad
  26.                         webApp: u.indexOf('Safari') == -1 //是否web应该程序,没有头部与底部
  27.                     };
  28.                 }(),
  29.                 language: (navigator.browserLanguage || navigator.language).toLowerCase()
  30.             }
  31.  
  32.             if (browser.versions.ios || browser.versions.iPhone || browser.versions.iPad) {
  33.                 window.location="";
  34.             }
  35.             else if (browser.versions.android) {
  36.                 window.location="or_andrapp.html";
  37.             }
  38.                         else
  39.                         {
  40.                                 window.location="or_index.html";
  41.                                 }
  42.     </script>
  43. </head>
  44. <body>
  45.         请在浏览器中打开
  46.     
  47. </body>
  48. </html>

  49. or_andrapp.html

  50. <!DOCTYPE html>
  51. <html lang="en">
  52. <head>
  53.         <meta charset="UTF-8">
  54.         <meta name="viewport" content="width=device-width, initial-scale=1"/>
  55.         <title>偶然手机端下载</title>
  56. </head>
  57. <body>
  58.         <style type="text/css">
  59.         *{margin:0; padding:0;}
  60.         img{max-width: 100%; height: auto;}
  61.         .test{height: 400px; max-width: 500px; font-size: 20px; }
  62.         .test a {width:260px; background:#51adee; display:block; color:#fff; padding:5px 8px ; margin:50% auto 0; text-align:center; text-decoration:none}
  63.         </style>
  64.         <div class="test"><a href="%2FOuran.apk#weixin.qq.com#wechat_redirect ">偶然Android手机端下载</a></div>
  65.         <script type="text/javascript" src=""></script>
  66.         <script type="text/javascript">
  67.                 function is_weixin() {
  68.                     var ua = navigator.userAgent.toLowerCase();
  69.                     if (ua.match(/MicroMessenger/i) == "micromessenger") {
  70.                         return true;
  71.                     } else {
  72.                         return false;
  73.                     }
  74.                 }
  75.                 var isWeixin = is_weixin();
  76.                 var winHeight = typeof window.innerHeight != 'undefined' ? window.innerHeight : document.documentElement.clientHeight;
  77.                 
  78.                 //在这里添加最后一行

  79.                 if(isWeixin){
  80.                         $("body").append(weixinTip);
  81.                 }
  82.                 $("#weixinTip").css({
  83.                         "position":"fixed",
  84.                         "left":"0",
  85.                         "top":"0",
  86.                         "height":winHeight,
  87.                         "width":"100%",
  88.                         "z-index":"1000",
  89.                         "background-color":"rgba(0,0,0,0.8)",
  90.                         "filter":"alpha(opacity=80)",
  91.                 });
  92.                 $("#weixinTip p").css({
  93.                         "text-align":"center",
  94.                         "margin-top":"20%",
  95.                         "padding-left":"5%",
  96.                         "padding-right":"5%"
  97.                 });
  98.         </script>
  99. </body>
  100. </html>
var weixinTip = $('

微信打开

'
);  //添加到上面标注的地方
阅读(2605) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~