Shubham Shubham - 1 year ago 86
Javascript Question

How to close browser tab

I am not able to close the current browser tab using javascript.

I tried-

window.close(); //1

window.open("", '_self');//2
setTimeout(function(){
window.close();
},100);

window.open('','_parent',''); //3
window.close();

window.top.opener=null; //4
window.close();


Nothing is working for me in chrome

Answer Source

window.close method is only allowed to be called for windows that were opened by a script using the window.open method.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download