源于生活
标题:
手机客户端自动选择包下载
[打印本页]
作者:
kevin-ying
时间:
2015-3-7 15:54
标题:
手机客户端自动选择包下载
下载页HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>客户端下载</title>
<script type="text/javascript">
var ua = navigator.userAgent.toLowerCase();
var ios_m = /ipad|iphone|ipod|ios/i;
//var ios_m = /\(i[^;]+;( u;)? cpu.+mac os x/i;
var and_m = /android/i
if (ua.match(ios_m) || ua == null) {
//ios版本
window.location.href = "itms-services://?action=download-manifest&url=http://www.example.com/lsios.plist";
}else if(ua.match(and_m)){
//安卓版本
window.location.href = "http://www.example.com/apk.apk";
}else{
//其他,下载IOS版本
window.location.href = "http://www.example.com/ios.ipa";
}
</script>
</head>
<body>
</body>
</html>
复制代码
lsios.plist文件代码:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>items</key>
<array>
<dict>
<key>assets</key>
<array>
<dict>
<key>kind</key>
<string>software-package</string>
<key>url</key>
<string><![CDATA[http://www.example.com/?http://www.example.com/ls/ios.ipa]]></string>
</dict>
<dict>
<key>kind</key>
<string>display-image</string>
<key>needs-shine</key>
<true/>
<key>url</key>
<string>http://www.example.com/lsicon.png</string>
</dict>
<dict>
<key>kind</key>
<string>full-size-image</string>
<key>needs-shine</key>
<true/>
<key>url</key>
<string>http://www.example.com/lsicon.png</string>
</dict>
</array>
<key>metadata</key>
<dict>
<key>bundle-identifier</key>
<string>com.example.ls</string>
<key>bundle-version</key>
<string>0.0.8</string>
<key>kind</key>
<string>software</string>
<key>subtitle</key>
<string><![CDATA[么么在线]]></string>
<key>title</key>
<string><![CDATA[么么在线,请确保您的设备已越狱。]]></string>
</dict>
</dict>
</array>
</dict>
</plist>
复制代码
欢迎光临 源于生活 (http://bbs.vingoo.info/)
Powered by Discuz! X3.1