1

I am trying to close the current open tab after 1 second.

Here is what I tried :

    $(function(e){

        setTimeout("window.top.close()", 1000) 

    )};

The code works in Edge but it does not work in Firefox.

I get this warning into the console when I try to close a page in Firefox :

Scripts may not close windows that were not opened by script.

How can I close the page?

ismnoiet
  • 4,129
  • 24
  • 30
Jaylen
  • 39,043
  • 40
  • 128
  • 221

1 Answers1

0

Simply you can not. The fact Microsoft Edge allows you to close tabs is a serious security breach, other safer internet browsers will not let you do something like that.

You can close tabs and windows which were opened by the script itself.

Your code seems correct anyway.