解决微信浏览器中不能下载apk的问题
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <div class="weixin-tip" style="display:none;"> <p> <img src="img/weixin-tip.jpg" class="weixinpic" alt="微信打开"/> </p> </div>
<style type="text/css"> a{text-decoration: none;} .weixinpic{width: 100%; height: 100%;} .weixin-tip{display: none; position: fixed; left:0; top:0; bottom:0; background: rgba(0,0,0,0.8); filter:alpha(opacity=80); height: 100%; width: 100%; z-index: 100;} .weixin-tip p{text-align: center;} </style>
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script> <script type="text/javascript"> $(function(){ var u = navigator.userAgent, app = navigator.appVersion; var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1;if(isAndroid){ alert("1"); var winHeight = $(window).height(); function is_weixin() { var ua = navigator.userAgent.toLowerCase(); if (ua.match(/MicroMessenger/i) == "micromessenger") { return true; } else { return false; } } var isWeixin = is_weixin();if(isWeixin){ $(".weixin-tip").css("height",winHeight); $(".weixin-tip").show(); }else { window.location.href = "http://zwzx.yl.gov.cn/CMS/apk/YL_APP.apk";//安卓下载地址 } }else{ alert("抱歉,目前只支持安卓下载!"); } }) </script> </head> <body> </body> </html>