vue关闭浏览器

关闭的是新开的页面才不会报错

closeWebPage() {

      //. ie浏览器

      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 '

      } else {

        //谷歌等其他浏览器

        window.opener = null

        window.open('', '_self', '')

        window.close()

      }

    },

猜你喜欢

转载自blog.csdn.net/ANNENBERG/article/details/128967286