Home > Software engineering >  Automatically close HTML page
Automatically close HTML page

Time:10-19

I have a Php document where after executing a query it will need to close the page.

My problem is that I cannot close the page.

I tried using javascript window.close(); but that does not work.

I also tried using simulated key press(that is using control w to close the tab) but was unsuccessful in making it work.

CodePudding user response:

You can use

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

CodePudding user response:

I remembered this from a another post. javascript close current window

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

  • Related