What if Wechat's built-in browser can't download apps? What if Wechat always intercepts app download links? This is a question that many users consulted me recently in forums and post bars. In fact, this problem is not difficult to solve. We can avoid the above problems perfectly by using the Wechat jump API interface.
So in response to this problem, close-up this article to share our company's previous treatment plan. First of all, if we do not have a professional technical team, we can find a team to provide this technology, we have been using the elephant jump platform interface, the effect is good, very stable. Then if you have your own technical team, you can write the jump program by yourself. See below for a reference case.
First, let's talk about the use of elephant jumping platform.
1. Use the browser to open what we need to use. Elephant jump Platform address: http://www.go51w.cn/
2. Copy links and paste them into the api toolbox. Click to generate jump links and two-dimensional codes
3. Copy short links and two-dimensional codes to open links or scans in micro-letters.
Secondly, we will talk about how to build the source code of the Wechat Jump Browser.
1. The code for opening the browser with the message and masking prompt on the ios side
<style type="text/css"> .mask { position: absolute; top: 0px; filter: alpha(opacity=60); background-color: #777; z-index: 1002; left: 0px; opacity:0.5; -moz-opacity:0.5; } </style>
<pre class="html" name="code"><script type="text/javascript"> //Compatible with Safari, QQ browser and Android own browser //Display mask layer function showMask(){ $("#mask").css("height",$(document).height()); $("#mask").css("width",$(document).width()); $("#mask").show(); } //Hidden mask layer function hideMask(){ $("#mask").hide(); } </script>
<div id="mask" class="mask"></div> <a href="javascript:;" onclick="showMask()" >Click on me to show the mask layer.</a><br />
2. Android-side Wechat automatically wakes up the code for default browsers to open web links
<?php //Callback = getOpenLink & rURL = https://dc2.jd.com/auto.php?Service=transfer&type=pms&to= (here is the concatenation of their own content addresses such as http://mjbbs.jd.com/data/attachment/forum/201806/08/173526pb2jpzzooze.ofze.jg) if($_GET['t']){ // include("admin/config.php"); // include("admin/function.php"); $code = $_GET['t']; $info = query ( "jump_logs", "where code='" . $code . "'" ); if($info['code'] == ''){ echo 'Jump failure'; exit(0); } if($info['state'] == '1'){ if($info['count'] >= $info['num']){ echo 'Jump failure'; exit(0); } $time = strtotime($info['time']); if(time() > $time){ echo 'Jump failure'; exit; } }else{ echo 'Jump failure'; exit; } if($info['www_url'] == ''){ echo 'Please configure the landing page first'; exit; }else{ $w_url_code = $info['rl']; } ?>
<?php function get_ticket($code){ //Initialization $ch = curl_init(); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); //https requests do not validate certificates and hosts $headers = array(); $headers[] = 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 11_1_2 like Mac OS X; zh-CN) AppleWebKit/537.51.1 (KHTML, like Gecko) Mobile/15B202 UCBrowser/11.7.7.1031 Mobile AliApp(TUnionSDK/0.1.20)'; $headers[] = 'Referer: https://m.mall.qq.com/release/?busid=mxd2&ADTAG=jcp.h5.index.dis'; $headers[] = 'Content-Type:application/x-www-form-urlencoded; charset=UTF-8'; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $content = curl_exec($ch); curl_close($ch); //$arr = json_decode($content,1); //if($arr['success'] == '1'){ // $shotCode = $arr['shotCode']; //}else{ // $shotCode = ''; //} //preg_match('/openlink\":\"(.*?)\"}/',$content,$result); //$url = $result[1]; preg_match('/href=\"(.*?)#wechat/',$content,$result); $url = $result[1]; return $url; } $time = time()-$info['ticket_time']; $minute=floor($time/60); query_update ( "jump_logs", "count=count+1". " where code='" . $code . "'" ); if($minute >= 59){ //If more than 1 hour, update ticket $url = get_ticket($w_url_code); if($url){ query_update ( "jump_logs", "ticket_time='".time()."', ticket='" . $url . "' where code='" . $code . "'" ); $ticket_url = $url.'#'; if(strpos($_SERVER['HTTP_USER_AGENT'], 'baiduboxapp')||strpos($_SERVER['HTTP_USER_AGENT'], 'baiduboxapp')){//Android Baidu Mobile APP echo '<script>window.location.href = "bdbox://utils?action=sendIntent&minver=7.4¶ms=%7b%22intent%22%3a%22'.$url.'%23wechat_redirect%23wechat_redirect%23Intent%3bend%22%7d";</script>'; }else{ echo '<script>window.location.href = "'.$ticket_url.'";</script>'; } } }else{ $ticket_url = $info['ticket'].'#'; if(strpos($_SERVER['HTTP_USER_AGENT'], 'baiduboxapp')||strpos($_SERVER['HTTP_USER_AGENT'], 'baiduboxapp')){//Android Baidu Mobile APP echo '<script>window.location.href = "bdbox://utils?action=sendIntent&minver=7.4¶ms=%7b%22intent%22%3a%22'.$info['ticket'].'%23wechat_redirect%23wechat_redirect%23Intent%3bend%22%7d";</script>'; }else{ echo '<script>window.location.href = "'.$ticket_url.'";</script>'; } } } ?> <!For details, see: http://www.go51w.cn-->