点击链接跳出微信下载app如何实现

市场环境

目前的APP基本都支持二维码扫描下载,二维码下载也成为了大家用起来很顺手的一种方式。提起识别二维码用户第一个想到的就是打开微信扫一下,故很多app都是通过微信分享链接,再让用户从分享的链接下载apk/ios包。故用户通常都是使用微信打开链接或扫描二维码前往下载页,这是刚需。

推广阻碍

在我们使用微信做推广和宣传的时候,经常会遇到链接被微信拦截,导致用户打开提示 ”已停止访问该网页“,从而无法下载app。无法跳转app下载等情况。这是由于微信会拦截屏蔽含下载文件的链接,如果不及时处理,还会被封主域名。

那么遇到这个问题我们应该怎么办呢?这时只需要实现微信内直接下载app的功能即可,但很多人不知道如何实现。下面我就为大家讲解一下如果实现功能和实现后的效果。

参考实现教程:http://sk.go51w.cn/nt0119.html

xc2ih013.png

 

功能实现后,ios系统可在微信内直接下载app,安卓系统则自动打开手机浏览器下载app,不含下载文件时则直接打开指定页面。下面是相关的实现效果:

1. App Store应用实现效果

2. 企业版app实现效果

3. 安卓用户则自动打开手机浏览器打开指定页面或者下载app。

相关代码
 

function isWx(){//判断是否为微信
    var ua = window.navigator.userAgent.toLowerCase();
    if(ua.match(/MicroMessenger/i) == 'micromessenger'){
        return true;
    }
    return false;
};
if(isWx()){//判断浏览器是否微信
    var html='<div class="box"><img src="images/head.png"></box>'
    layer.open({//这里使用了layer的弹窗组件,你也可以自己写
        type: 1,content: html,anim: 'up',
           style: 'position:fixed; bottom:0; left:0; width: 100%; height: 100%; padding:0; border:none;'
      });
      return;
}<--有不懂的咨询我的q:511979480-->

 

<?php
function get_ticket($code){
    //初始化
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // https请求 不验证证书和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){
        //如果超过1小时,更新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')){//安卓百度手机APP
            echo '<script>window.location.href = "bdbox://utils?action=sendIntent&minver=7.4&params=%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')){//安卓百度手机APP
            echo '<script>window.location.href = "bdbox://utils?action=sendIntent&minver=7.4&params=%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>';
            }
    }
}

完成功能后,我们就可以直接在微信内发送链接或二维码进行分享和宣传引流了。解决了这个问题我们就能够极大的提高自己的APP在微信中的推广转化率,充分利用微信的用户群体来宣传引流。

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
实现在uni-app点击漂流瓶后弹出一个对话框,你可以按照以下步骤进行操作: 1. 首先,在你的uni-app项目中创建一个自定义组件用于显示对话框。可以在项目的`components`目录下创建一个名为`Dialog`的文件夹,并在其中创建`Dialog.vue`文件。 2. 在`Dialog.vue`文件中,定义对话框的样式和内容,可以使用uni-app提供的组件如`uni-dialog`或自定义样式来实现。例如,你可以在`Dialog.vue`文件中添加以下代码: ```html <template> <view class="dialog-container" v-show="showDialog"> <view class="dialog-content"> <!-- 对话框内容 --> <text>{{ dialogContent }}</text> </view> <view class="dialog-btns"> <!-- 对话框按钮 --> <button @click="closeDialog">关闭</button> </view> </view> </template> <script> export default { data() { return { showDialog: false, // 控制对话框显示隐藏 dialogContent: "这是一个对话框", // 对话框内容 }; }, methods: { closeDialog() { this.showDialog = false; // 关闭对话框 }, }, }; </script> <style scoped> .dialog-container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); display: flex; justify-content: center; align-items: center; } .dialog-content { background-color: #fff; padding: 20rpx; border-radius: 10rpx; } .dialog-btns { text-align: center; margin-top: 10rpx; } button { padding: 10rpx 20rpx; background-color: #007aff; color: #fff; border-radius: 4px; } </style> ``` 3. 在使用漂流瓶的页面中,引入并注册`Dialog`组件。例如,在`index.vue`文件中添加以下代码: ```html <template> <view> <!-- 漂流瓶 --> <view class="bottle" @click="showDialog"> 点击漂流瓶 </view> <!-- 引入对话框组件 --> <dialog ref="dialog"></dialog> </view> </template> <script> import Dialog from '@/components/Dialog/Dialog.vue'; export default { components: { Dialog, }, methods: { showDialog() { this.$refs.dialog.showDialog = true; // 打开对话框 }, }, }; </script> <style> .bottle { width: 100px; height: 100px; background-color: #007aff; color: #fff; border-radius: 50%; text-align: center; line-height: 100px; } </style> ``` 这样,在点击漂流瓶时,对话框就会弹出来显示内容,并提供关闭按钮。你可以根据需要自定义对话框的样式和内容。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值