各种浏览器 关闭页面 实现

微信关闭

<script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script>
    wx.config({
        debug:     false,
        appId:     '<?php echo $signPackage["appId"];?>',
        timestamp: '<?php echo $signPackage["timestamp"];?>',
        nonceStr:  '<?php echo $signPackage["nonceStr"];?>',
        signature: '<?php echo $signPackage["signature"];?>',
        jsApiList: [
            'closeWindow'
        ]
    });
    wx.ready(function () {
        document.querySelector('#binding_submit').onclick = function () {
            wx.closeWindow();
        }
    });
</script>

 IE,firefox关闭

function f_close(){
    if (navigator.userAgent.indexOf("MSIE") > 0) {
        if (navigator.userAgent.indexOf("MSIE 6.0") > 0) {
            window.opener = null; window.close();
        } else {
            window.open('', '_top'); window.top.close();
        }
    } else if (navigator.userAgent.indexOf("Firefox") > 0) {
        window.location.href = 'about:blank ';
        //window.history.go(-2);
    } else {
        window.opener = null;
        window.open('', '_self', '');
        window.close();
    }
}

 ss

猜你喜欢

转载自hudeyong926.iteye.com/blog/2421918