标签:turn nbsp return == color 打开 fine 安全 images
/**
* 判断是否在微信里打开
*/
function isWeiXin()
{
var ua = window.navigator.userAgent.toLowerCase();
if(ua.match(/MicroMessenger/i) == ‘micromessenger‘)
{
return true;
}else
{
return false;
}
}
/**
* 判断是否在QQ里打开
*/
function isQQ()
{
var ua = window.navigator.userAgent.toLowerCase();
if(ua.match(/QQ/i)==‘qq‘){
return true;
}else{
return false;
}
}
由于微信对不安全的url不进行传参,需要在浏览器中打开的指示页:
/**
* 加载页面时,对微信和QQ内置的浏览器进行判断
*/
function load(){
var winHeight = typeof window.innerHeight != ‘undefined‘ ? window.innerHeight : document.documentElement.clientHeight;
var weixinTip = $(‘<div id="weixinTip"><p><img src="image/live_weixin.png" alt="微信打开" style="width:100%;"/></p></div>‘);
if(isWeiXin())
{
$("body").append(weixinTip);
/*
var p = $("#bb");//document.getElementsByTagName(‘body‘);
//<td><img src=‘../image/timg.jpeg‘ width=‘100%‘ id=‘imagesrc‘/></td>
p[0].innerHTML = "<font color=\"#FF0000\">点击右上角,选择其它浏览器打开网页</font><img src=\"image/live_weixin.png\" width=\"100%\">"; */
}else if(isQQ()){
$("body").append(weixinTip);
}
$("#weixinTip").css({
"position":"fixed",
"left":"0",
"top":"0",
"height":winHeight,
"width":"100%",
"z-index":"1000",
"background-color":"rgba(0,0,0,0.8)",
"filter":"alpha(opacity=80)",
});
$("#weixinTip p").css({
"text-align":"center",
"margin-top":"10%",
"padding-left":"5%",
"padding-right":"5%"
});
}
标签:turn nbsp return == color 打开 fine 安全 images
原文地址:http://www.cnblogs.com/liuyun-10/p/7567734.html