window.open 、window.close关闭兼容多个浏览器

  • window.open 兼容写法
  openPage(id, name, path) {
    let newWebPage = window.open();
    newWebPage.location =
      '/#/preview?id=' + id + '&name=' + name + '&path=' + path;
  }
  • window.close
 closePage = () => {
    if (navigator.userAgent.indexOf('MSIE') > 0) {
      window.top.close();
    } else {
      window.close();
    }
  };
```

你可能感兴趣的:(window.open 、window.close关闭兼容多个浏览器)