Want to detect user on last tab and then if user click back button browser need to close.
I've tried this.
window.onpopstate = e=>{
e.preventDefault();
if(e.state==null){
let win = window.open("about:blank", "_self");
win.close();
}
}
above code opening new tab but not closing current tab.
Note this error too. "Scripts may close only the windows that were opened by it."