html 加 微信遮罩代码,现有一段微信遮罩代码,求大佬帮写一段微信QQ二合一的...

[JavaScript] 纯文本查看 复制代码//$url = $_GET['url'];

function is_weixin_visit()

{

if (strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false) {

return true;

} else {

return false;

}

}

$html = <<

请用浏览器打开

document.οncοntextmenu=new Function("event.returnValue=false;");

document.onselectstart=new Function("event.returnValue=false;");

*{margin:0; padding:0;}

img{max-width: 100%; height: auto;}

.test{height: 600px; max-width: 600px; font-size: 40px;}

function is_weixin() {

var ua = navigator.userAgent.toLowerCase();

if (ua.match(/MicroMessenger/i) == "micromessenger" || ua.match(/QQ/i) == "qq") {

return true;

} else {

return false;

}

}

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 = '

微信打开

';

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: 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{text-align: center; margin-top: 10%; padding:0 5%;}";

if(isWeixin){

loadHtml();

loadStyleText(cssText);

}

HTML;

if(is_weixin_visit()){

echo $html;

exit;

}

//echo '我不是微信业务代码执行';

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值