js关闭当前页面

老式关闭当前页面js
window.opener=null;
window.open('','_self');
window.close();

 但是关闭 Chrome 浏览器会有问题

Scripts may close only the windows that were opened by it.

 

搜了半天居然没有答案;所以我自己发上来以便别人需要

关闭当前页面js

open(location, '_self').close();

你可能感兴趣的:(js关闭页面)