是否为微信浏览器

时间:2018-05-07 16:09:09   收藏:0   阅读:191

    

function closexy() {

   var ua = navigator.userAgent;

   if (navigator.userAgent.indexOf("MicroMessenger") != -1) {

      if (ua.substring(ua.indexOf("MicroMessenger/") + 15, ua.indexOf("MicroMessenger/") + 16) >= 5) {

          window.history.back();

      }

   } else {   

    window.close();

   }

}

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!