0

I tried to close current tab in my ajax success using following command

window.close();

but that function didn't work, I tried some solutions given in here(stackoverflow) that too doesnt work. It throws the following browser console warning.

Scripts may close only the windows that were opened by it.

Is there any way to close it. kindly suggest any way to close it through javascript/jquery

Barmar
  • 741,623
  • 53
  • 500
  • 612
venkat
  • 73
  • 2
  • 14
  • 4
    The warning is very clear: A script can only close windows or tabs that it opened. A script can't close the window that's in, since that was opened by the user, not by the script. – Barmar Jan 23 '17 at 07:24
  • Is there any other way to perform closing tab in ajax success. Because its my single page application . – venkat Jan 23 '17 at 07:35
  • No, Javascript is simply not allowed to close the user's tab. – Barmar Jan 23 '17 at 07:37
  • Just replace the contents with a `You are now logged out` page. – Barmar Jan 23 '17 at 07:37

0 Answers0