<script>
// 微信界面打开有图片罩住的效果js(这是symfony框架下的代码)。
var downurl= '<?= $downurl?>';
var wapurl = '<?= $wapurl?>';
function is_weixin() {
var ua = navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) == "micromessenger") {
return true;
}
}
var isWeixin = is_weixin();
var winHeight = typeof window.innerHeight != 'undefined' ? window.innerHeight : document.documentElement.clientHeight;
function loadHtml(){
var div = document.createElement('div');
div.id = 'weixin-tip';
div.innerHTML = '<p><img id="wx-img" src="{{ assetUrl('images/live_weixin.png','res') }}" alt="微信打开"/></p>';
document.body.appendChild(div);
}
function loadStyleText(cssText) {
var style = document.createElement('style');
style.rel = 'stylesheet';
style.type = 'text/css';
try {
style.appendChild(document.createTextNode(cssText));
} catch (e) {
style.styleSheet.cssText = cssText; //ie9以下
}
var head=document.getElementsByTagName("head")[0]; //head标签之间加上style样式
head.appendChild(style);
}
var cssText = "#weixin-tip{position: absolute; left:0; top:0; background: rgba(0,0,0,0.8); filter:alpha(opacity=80); width: 100%; height:960px; z-index: 1000;} #weixin-tip p{text-align: center; margin-top: 10%; padding:0 5%;}#wx-img{ width: 95%; position: absolute;left: 15px;top: 0px;}";
if(isWeixin){
loadHtml();
loadStyleText(cssText);
}
<script>
微信页面打开链接,引导在其他浏览器打开的引导页
最新推荐文章于 2021-03-12 22:18:58 发布