Through the sweep of Wechat to download, there will be a white screen situation, perhaps because of security considerations or other reasons, it is no longer possible to download the apk through the sweep of Wechat.
According to the ideas provided by netizens, this paper sorted out three schemes.
1. Developers applying for Tencent Open Platform
The specific process can access http://open.qqq.com/, which means that we need to submit APK to Tencent Open Platform. Each APK should automatically generate a two-dimensional code, pay a certain fee every year, and then scan the two-dimensional code in the Wechat. At this time, we also need to install a mobile app to install the apk.
For such a scheme, we can only use a very popular phrase: "very capricious".
2. Redirection
This method is useful for some published two-dimensional codes, and it is also a common practice at present. It's impossible that because Wechat can't download directly, we have to regenerate all the two-dimensional codes that have already flowed out.
2.1 Judging Browser Type
/ First, determine whether it is a pc, and if it is accessed by a pc, jump to http://app.ctrip.com//?
var u = navigator.userAgent || '';
var isPC = !/(iphone|ios|android|mini|mobile|mobi|Nokia|Symbian|iPod|iPad|Windows\s+Phone|MQQBrowser|wp7|wp8|UCBrowser7|UCWEB|360\s+Aphone\s+Browser)/i.test(u);
if (isPC) { location.href = "http://www.hipermart.com.cn"; }
If it's on the pc side, redirect directly to a website
If it's not on the pc side, do you want to distinguish android from apple?
2.2 Judgment is android or iOS?
Because we assume that iOS downloads must be downloaded from Apple's app store, the download address has a certain regularity, such as sourceid.
It can be determined by a regular expression.
var urls = document.location.search, re2 = new RegExp("(\\?|&)sourceid=([^&]+)(&|$)", "i"), from = urls.match(re2);
if (from) { sid = from[2]; }
document.location.search
For example, if a URL is XXXX?g=1, then the value of document.location.search is? g=1
2.3 redirect to download address
window.onload = function () {// Repair image occasionally cannot be loaded
var salesLocal = localStorage.getItem("SALESOBJ") ? JSON.parse(localStorage.getItem("SALESOBJ")) : null;
var appUrl = salesLocal && salesLocal.data && salesLocal.data.appurl ? salesLocal.data.appurl : "";
if (!isPC && !iswx) {
if(appUrl){
location.href = appUrl;
}else if(sid){
location.href = "/m/" + sid;
}
}
}
2.4 html page source file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title> Download Heimat Client </title>
<meta name="viewport" content="width=320.1, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta content="telephone=no" name="format-detection" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<!--link href="css/main.css" rel="stylesheet" type="text/css"-->
<style type="text/css">
body {height: 100%;}
.container {padding:0 20px;background-image: url(images/bg.jpg);background-position: center center;background-size: 100% 100%;height: 100%;}
.dl-step {padding-top: 58px;} .dl-step .step {clear: both;} .dl-step .index {float: left;height: 36px;width: 36px;border: 2px solid #fff;background-color: #ffba26;border-radius: 50%;text-align: center;line-height: 36px;position: relative;background-clip: padding-box;color: #fff;} .dl-step .content {margin-left: 70px;border-radius: 4px;padding:8px 13px 13px;position: relative;} .dl-step-1 {margin-bottom: 60px;position: relative;} .dl-step-1 .content {background-color: #ffba26;box-shadow: 0 1px 2px rgba(0,0,0,0.5);font-size: 15px;color: #fff;padding: 0 13px;height: 38px;line-height: 38px;} .dl-step-1:before { content: ""; display: block; width: 89px; height: 75px; position: absolute; right: 0; top: -56px; background-image: url(images/icons.png); background-size: auto 213px; background-repeat: no-repeat; background-position: 0 0; z-index: 10; } .dl-step-1 .index:before { content: ""; display: block; height: 45px; width: 2px; background-color: #fff; position: absolute; top: 45px; left: 17px; border-radius: 2px; } .dl-step-2 {margin-bottom: 58px;} .dl-step-2 .index, .dl-step-3 .index {background-color: rgba(39,41,57,0.2);} .dl-step-2 .content, .dl-step-3 .content {background-color: rgba(255,255,255,0.9);box-shadow: 0 1px 2px rgba(0,0,0,0.3);} .dl-step-2 .content .tip, .dl-step-3 .content .tip {margin-bottom: 2px;font-size: 15px;color: #333;font-family: Microsoft Yahei;} .dl-step-2 .index:before { content: ""; display: block; height: 128px; width: 2px; background-color: #fff; position: absolute; top: 45px; left: 17px; border-radius: 2px; } .dl-devices {overflow: hidden;} .dl-devices .item {background-color: #ceecfb;width: 49%;float: left;padding: 5px 0;} .dl-devices .android {margin-left: 1px;} .dl-devices .name {float: left;background-color: #fff;padding: 0 4px;color: #666;line-height: 14px;font-size: 12px;font-family: Microsoft Yahei;} .dl-devices .icon {height: 40px;clear: left;background-image: url(images/icons1.png);background-size: auto 213px;background-repeat: no-repeat;} .dl-devices .desc {color:#666;font-size: 10px;text-align: center;font-family: Microsoft Yahei;} .dl-devices .ios .icon {background-position: center -85px;} .dl-devices .android .icon {background-position: center -131px;} .dl-step-3 .app {background-color: #ceecfb;padding: 8px 25px;} .dl-step-3 .app .icon {padding-left: 38px;height:31px;line-height:31px;background-image: url(images/icons2.png);background-repeat: no-repeat;background-position: -29px -182px;background-size: auto 213px;font-size: 10px;color: #666;font-family: Microsoft Yahei;} .dl-step .content:before { content: ""; display: block; height: 0; width: 0; border: 5px solid transparent; border-right-color: rgba(0,0,0,0.1); position: absolute; top: 14px; left: -11px; } .dl-step .content:after { content: ""; display: block; height: 0; width: 0; border: 5px solid transparent; position: absolute; top: 13px; left: -10px; } .dl-step-1 .content:after {border-right-color: #ffba26;} .dl-step-2 .content:after, .dl-step-3 .content:after {border-right-color: rgba(255,255,255,0.9);} </style> <script> /*First, determine whether it is a pc, and if it is accessed by a pc, jump to http://app.ctrip.com/?*/ var u = navigator.userAgent || ''; var isPC = !/(iphone|ios|android|mini|mobile|mobi|Nokia|Symbian|iPod|iPad|Windows\s+Phone|MQQBrowser|wp7|wp8|UCBrowser7|UCWEB|360\s+Aphone\s+Browser)/i.test(u); if (isPC) { location.href = "http://www.hipermart.com.cn"; } </script> <script src="js/require.min.js"></script> <!--script type="text/javascript"> var libs = 'libs_r_3.js'; if (!('__proto__' in {})) { libs = 'libs_jq_r_1.1.js'; } document.write('<script type="text/javascript" src="js/' + libs + '"></' + 'script>'); </script--> <!--script src="js/m.ctrip.com.core.min.js"></script--> <script> var isPC = false; var e = navigator.userAgent ? navigator.userAgent.toLowerCase() : ''; var iswx = /micromessenger/.test(e) ? !0 : !1; var wxurl = ''; if (iswx) { wxurl = "http://mp.weixin.qq.com/mp/redirect?url="; } // window.onload = function () {// Repair image occasionally cannot be loaded function hello() { //Repaired images occasionally cannot be loaded var appUrl = "http://app.hipermart.com.cn:8888/apk/hipermart.apk"; if (!isPC && !iswx) { if(appUrl){ location.href = appUrl; }else if(sid){ location.href = "/m/" + sid; } } } </script>
</head>
<body onload="hello()">
<div class="container">
<div class="dl-step">
<div class="step dl-step-1">
<div class="index">1</div>
<div class= "content">click on the top right </div>
</div>
<div class="step dl-step-2">
<div class="index">2</div>
<div class="content">
<p class="tip">Select Open in Browser</p>
<div class="dl-devices">
<!--div class="item ios">
<span class="name">iOS</span>
<div class="icon"></div>
<p class="desc">Open in Safari</p>
</div-->
<div class="item android">
<span class="name">Android</span>
<div class="icon"></div>
<p class="desc">Open in browser</p>
</div>
</div>
</div>
</div>
<div class="step dl-step-3">
<div class="index">3</div>
<div class="content">
<p class="tip">You can download APP automatically.</p>
<div class="app">
<div class="icon">Heimat client </div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
3. Tool whirlwind slightly jumping http://www.ccjump.cn
Whirlwind Micro-Jump is a marketing download promotion assistant based on the back end of Wechat. It uses the links generated by this plug-in. Users can click on links or scan two-dimensional codes under the micro-trust environment, and can directly jump to the default browser of mobile phones and open the designated web pages.
1. Open the Cyclone Skip Website: http://www.ccjump.cn
2. Prepare our promotion links: example: www.baidu.com in the input box to fill in your download link, after completion. Click the Generation Button
3. Click on the generated, you will see that the bottom generated its own promotion of two-dimensional code and short URL link address.
So far, we have generated two-dimensional codes and links for the promotion of APP links. We can share and publicize the drainage in micro-letters directly by scanning two-dimensional codes with micro-letters. In this way, we can greatly improve our APP.