设为首页收藏本站关注微信<<< 抵制 IE6 人人有责 >>>
搜索
热搜: 活动 交友 discuz
查看: 1543|回复: 0

[Html] 手机客户端自动选择包下载

[复制链接]
发表于 2015-3-7 15:54:01 | 显示全部楼层 |阅读模式
下载页HTML:
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  6. <title>客户端下载</title>
  7. <script type="text/javascript">
  8. var ua = navigator.userAgent.toLowerCase();
  9. var ios_m = /ipad|iphone|ipod|ios/i;
  10. //var ios_m = /\(i[^;]+;( u;)? cpu.+mac os x/i;
  11. var and_m = /android/i
  12. if (ua.match(ios_m) || ua == null) {
  13.         //ios版本
  14.         window.location.href = "itms-services://?action=download-manifest&url=http://www.example.com/lsios.plist";
  15. }else if(ua.match(and_m)){
  16.         //安卓版本
  17.         window.location.href = "http://www.example.com/apk.apk";
  18. }else{
  19.         //其他,下载IOS版本
  20.         window.location.href = "http://www.example.com/ios.ipa";
  21. }
  22. </script>
  23. </head>
  24. <body>
  25. </body>
  26. </html>
复制代码

lsios.plist文件代码:
  1. <?xml version="1.0" encoding="UTF-8"?>

  2. <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  3. <plist version="1.0">
  4.   <dict>
  5.     <key>items</key>
  6.     <array>
  7.       <dict>
  8.         <key>assets</key>
  9.         <array>
  10.           <dict>
  11.             <key>kind</key>
  12.             <string>software-package</string>
  13.             <key>url</key>
  14.             <string><![CDATA[http://www.example.com/?http://www.example.com/ls/ios.ipa]]></string>
  15.           </dict>
  16.           <dict>
  17.             <key>kind</key>
  18.             <string>display-image</string>
  19.             <key>needs-shine</key>
  20.             <true/>
  21.             <key>url</key>
  22.             <string>http://www.example.com/lsicon.png</string>
  23.           </dict>
  24.           <dict>
  25.             <key>kind</key>
  26.             <string>full-size-image</string>
  27.             <key>needs-shine</key>
  28.             <true/>
  29.             <key>url</key>
  30.             <string>http://www.example.com/lsicon.png</string>
  31.           </dict>
  32.         </array>
  33.         <key>metadata</key>
  34.         <dict>
  35.           <key>bundle-identifier</key>
  36.           <string>com.example.ls</string>
  37.           <key>bundle-version</key>
  38.           <string>0.0.8</string>
  39.           <key>kind</key>
  40.           <string>software</string>
  41.           <key>subtitle</key>
  42.           <string><![CDATA[么么在线]]></string>
  43.           <key>title</key>
  44.           <string><![CDATA[么么在线,请确保您的设备已越狱。]]></string>
  45.         </dict>
  46.       </dict>
  47.     </array>
  48.   </dict>
  49. </plist>
复制代码



回复

使用道具 举报

您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

QQ|手机版|Archiver|源于生活(个人生活娱乐工作的笔记)css3,html5,学习笔记    

GMT+8, 2024-3-29 09:42 , Processed in 0.109200 second(s), 28 queries .

Powered by Mr.Kevin-ying

© 2004-2015

快速回复 返回顶部 返回列表