插件API说明:http://126.am/sxawz0
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>body{background:#fff;font-size:51px;}</style>
</head>
<body>
<p><a onclick="WX.isWXAppInstalled()">判断是否已安装微信</a></p>
<p><a onclick="WX.sendTextContent(1,'分享内容')">分享文字到朋友圈</a></p>
<p><a onclick="WX.sendTextContent(0,'分享内容')">分享文字到好友</a></p>
<p><a onclick="WX.sendImageContent()">分享图片到朋友圈</a></p>
<p><a onclick="location.reload()">刷新</a></p>
<script>
var WX = {
registerApp : function(){
if(!this._init){
uexWeiXin.registerApp('wx353ff72481b15c03');
this._init = true;
}
},
isWXAppInstalled : function(){
this.registerApp();
uexWeiXin.cbIsWXAppInstalled = function(opId,dataType, data){
if(data=='1'){
alert('已安装');
}else{
alert('未安装');
}
};
uexWeiXin.isWXAppInstalled();
},
sendTextContent : function(sence,content){
this.registerApp();
uexWeiXin.sendTextContent(sence,content);
},
sendImageContent : function(){
this.registerApp();
uexWeiXin.sendImageContent(1,'http://img0.bdstatic.com/img/image/shouye/mxkzd.jpg','http://img0.bdstatic.com/img/image/shouye/mxtw.jpg','百度','一个搜索引擎','http://www.baidu.com')
}
}
</script>
</body>
</html>