微信跳转手机默认浏览器打开指定HTML链接 微信点击链接直接下载安装包实现方式及源码
生活随笔
收集整理的這篇文章主要介紹了
微信跳转手机默认浏览器打开指定HTML链接 微信点击链接直接下载安装包实现方式及源码
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
需求:微信跳轉手機默認瀏覽器打開指定HTML鏈接 微信點擊鏈接直接下載安裝包
原因:在微信內不允許直接下載apk
這里有一個解決方案,直接上關鍵代碼
<!doctype html> <html lang="en"> <head><meta charset="UTF-8"><meta content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=2.0, user-scalable=no, width=device-width" name="viewport"><meta http-equiv="X-UA-Compatible" content="ie=edge"><meta name="description" content="" /><meta name="keywords" content="" /><!--<link rel="stylesheet" type="text/css" href="__CSS__/ionic.min.css"> --><link rel="stylesheet" type="text/css" href="css/swiper.min.css"><link rel="stylesheet" type="text/css" href="css/wx.css"><title>下載APP</title> </head> <style>*{margin:0px;padding:0px;}body{background:#fff;/*overflow:hidden;*/}#weixin-tip img{width:100%;}#weixin-tip{display:none;position:fixed;left:0;top:0;background:rgba(0,0,0,0.8);filter:alpha(opacity=80);width:100%;height:100%;z-index:100;}#weixin-tip p{position:relative;width:90%;margin:0 auto;}#weixin-tip .close{color:#fff;padding:5px;font:bold 20px/24px simsun;text-shadow:0 1px 0 #ddd;position:absolute;top:0;left:0;} </style> <body><a id="J_weixin" href='文件下載地址'><div id="weixin-tip"><p><img src="__STATIC__/index/lib/tp_1.png" alt="微信打開"/><span id="close" title="關閉" class="close">×</span></p></div> </body> <script>var is_weixin = (function(){return navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1})();window.onload = function() {var winHeight = typeof window.innerHeight != 'undefined' ? window.innerHeight : document.documentElement.clientHeight; //兼容IOS,不需要的可以去掉var btn = document.getElementById('J_weixin');var tip = document.getElementById('weixin-tip');var close = document.getElementById('close');if (is_weixin) {btn.onclick = function(e) {tip.style.height = winHeight + 'px'; //兼容IOS彈窗整屏tip.style.display = 'block';return false;}close.onclick = function() {tip.style.display = 'none';}}}// var remap=document.getElementById('remap');// remap.style.height=(winHeight-20) + 'px'; </script> </html>案例展示:
隨著研究的深入,技術的發展進步,現在可以直接微信跳轉瀏覽器,避免微信右上角,畢竟這個環節客戶流失會增加不少!
案例展示:
測試地址:http://wzf.zjychina.cn/wt0455.html
我們就可以直接用微信掃描二維碼在微信中分享和宣傳引流了。這樣我們能夠極大的提高自己的APP在微信中的推廣轉化率。解決掉了微信中下載鏈接被屏蔽等問題。充分利用微信的用戶群體來宣傳引流。
總結
以上是生活随笔為你收集整理的微信跳转手机默认浏览器打开指定HTML链接 微信点击链接直接下载安装包实现方式及源码的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 小红书-内卖秒杀项目总结
- 下一篇: Redis实现手机验证码功能