首页 > 代码库 > 微信客户端自带的Js Api:WeixinJSBridge

微信客户端自带的Js Api:WeixinJSBridge


<!DOCTYPE html>
<html>
<head><title>微信WeixinJSBridge API</title>
<meta charset=utf-8>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<script type="text/javascript">
(function(){
var a=document.getElementsByTagName("html")[0];
window.Session={appDomain:a.getAttribute("data-app-domain")||"",staticDomain:a.getAttribute("data-static-domain")||""}
})();

window.registNS=function(fullNS,isIgnorSelf){
var reg=/^[_$a-z]+[_$a-z0-9]*/i;var nsArray=fullNS.split(".");
var sEval="";
var sNS="";
var n=isIgnorSelf?nsArray.length-1:nsArray.length;
for(var i=0;i<n;i++){
	if(!reg.test(nsArray[i])){throw new Error("Invalid namespace:"+nsArray[i]+"");
	return
	}
	if(i!=0){sNS+="."}
	sNS+=nsArray[i];
	sEval+="if(typeof("+sNS+")=='undefined') "+sNS+"=new Object();
	else "+sNS+";"
}
if(sEval!=""){
return eval(sEval)
}
return{}

};
</script>

</head>
<body><section class=mod-page-body>
<div class="mod-page-main wordwrap clearfix">
	<div class=mod-pageheader></div>
	<div class=mod-pagecontent>
	<div class=mod-weixinjsapi>
		<div class=x-desc>微信客户端自带的Js Api:WeixinJSBridge</div>
		<div id=WeixinJsApi>
          		<input type=button id=imagePreview value=http://www.mamicode.com/"图片预览">>

微信客户端自带的Js Api:WeixinJSBridge