1、搭建服务器,推荐Apache或者Nginx,将index.html文件放到服务器中
http://127.0.0.1:8888/index.html
2、使用草料二维码生成器,生成一个二维码
3、index.html文件内容
<!DOCTYPE HTML>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>废柴兄弟之为爱狂奔</title>
<style type="text/css">
body
{
font-family : 微软雅黑,宋体;
font-size : 3em;
color : #000;
text-align: center;
padding-top: 200px;
}
.tip1
{
padding-bottom: 50px;
}
</style>
<script type="text/javascript">
// 获取终端的相关信息
var Terminal = {
// 辨别移动终端类型
platform : function(){
var u = navigator.userAgent, app = navigator.appVersion;
return {
// android终端或者uc浏览器
android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1,
// 是否为iPhone或者QQHD浏览器
iPhone: u.indexOf('iPhone') > -1 ,
// 是否iPad
iPad: u.indexOf('iPad') > -1
};
}()
}
// 默认
var theUrl = 'http://cdn.data.video.iqiyi.com/cdn/ppsgame/20151215/upload/unite/single/20151215/5db9aba9e2d3eabf3f0dc0b660f3acc2_fcxdzwakb1215_1.apk';
if(Terminal.platform.android)
{
theUrl = 'http://cdn.data.video.iqiyi.com/cdn/ppsgame/20151215/upload/unite/single/20151215/5db9aba9e2d3eabf3f0dc0b660f3acc2_fcxdzwakb1215_1.apk';
}
if(Terminal.platform.iPhone || Terminal.platform.iPad)
{
theUrl = 'https://itunes.apple.com/us/app/fei-chai-xiong-di-zhi-wei/id1037756617?l=zh&ls=1&mt=8';
}
function isWeiXin()
{
var ua = window.navigator.userAgent.toLowerCase();
if(ua.match(/MicroMessenger/i) == 'micromessenger')
{
return true;
}
else
{
return false;
}
}
window.onload = function()
{
if(isWeiXin())
{
var inner = document.getElementById('inner');
inner.innerHTML = "<div class='tip1'>微信不支持打开下载呢~</div><div class='tip2'>请点击右上角,用手机浏览器打开下载!</div>";
}
else
{
var inner = document.getElementById('inner');
inner.innerHTML = "<div>正在下载,请稍候...</div>";
location.href = theUrl;
}
}
</script>
</head>
<body>
<div id='inner'>
</div>
</body>
</html>
网友评论