微信中該如何使用外部瀏覽器打開指定網頁html鏈接
阿新 • • 發佈:2019-01-10
return android posit undefine avi rfi lang lse sdn
使用微信打開網址時,無法在微信內打開常用下載軟件,手機APP等。
解決方案:彈出一個遮罩提示用戶在新的瀏覽器窗口打開。
解決方案:彈出一個遮罩提示用戶在新的瀏覽器窗口打開。
使用的是純JS+HTML+CSS結合的方式,但不要一進入微信就彈出提示它在新瀏覽器中打開,在這個頁面裏面還可以提交表單查看信息等,只有它點擊應用的鏈接後,才彈出提示它跳轉後下載。
-
<a id="J_weixin" class="android-btn" href="#"><img src="img/android-btn.png" alt="安卓版下載" /></a>
-
<div id="weixin-tip"
-
#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
-
#weixin-tip .close{color:#fff;padding:5px;font:bold 20px/24px simsun;text-shadow:0 1px 0 #ddd;position:absolute;top:0;left:5%;}
-
var is_weixin = (function(){return navigator.userAgent.toLowerCase().indexOf(‘micromessenger‘
-
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‘;
-
}
-
}
-
}
效果圖:
源碼參考:http://blog.csdn.net/netuser1937/article/details/73647909
微信中該如何使用外部瀏覽器打開指定網頁html鏈接