关闭当前网页窗口

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>

<!--例子:http://openjsapi.sinaapp.com/closeWindow.php-->
</head>

<body> 
  <article> 
   <header>关闭当前网页窗口-jsapi示例:</header>
   <div id="card">
       <br /><br />
       <h>说明:请在微信中访问本网页,点击以下链接可实现”关闭当前网页窗口“</h>
       <br /><br />
       <a href="javascript:void(0)" id="closeWindow">关闭当前webview窗口,权位:closeWindow</a>
       
   </div>
  <script>

var readyFunc = function onBridgeReady() {
    var curid;
    var curAudioId;
    var playStatus = 0;
 
    
    // 关闭当前webview窗口 - closeWindow
    document.querySelector('#closeWindow').addEventListener('click', function(e){
        WeixinJSBridge.invoke('closeWindow',{
        },function(res){
            
            //alert(res.err_msg);
 
       });
    });    
    
}


if (typeof WeixinJSBridge === "undefined") {
  document.addEventListener('WeixinJSBridgeReady', readyFunc, false);
} else {
  readyFunc();
}


</script> 
     </article>     
 </body>
</html>

 

给心灵一个纯净空间,让思想,情感,飞扬!