0

I am trying to close the current tab when the user clicks on the 'CloseWindow' Button. Whatever I try

VM303:1 Scripts may close only the windows that were opened by them.

statement is displayed. I tried all the workarounds using self, window.opener.close() etc.
Has anyone done and it's working please share and help. I am using React framework. I am trying this in a jsx file.

Suraj Rao
  • 29,388
  • 11
  • 94
  • 103
sara
  • 1
  • [JavaScript is not Java](http://javascriptisnotjava.com) – nare214 Feb 04 '22 at 05:24
  • In Javascript to close a window you just need to do window.close() – Apoorv Feb 04 '22 at 05:38
  • 2
    Does this answer your question? [window.close and self.close do not close the window in Chrome](https://stackoverflow.com/questions/19761241/window-close-and-self-close-do-not-close-the-window-in-chrome) – Hyunjune Kim Feb 04 '22 at 06:18

0 Answers0