How to close the Current opened Tab and go back to previous (Parent) Tab

It is not a duplicate question please Dear All, I am new to Jquery, Please help me how to close the Current opened Tab in a application using Jquery on click of YES/Confirm button in a model window as shown in a image. I have tried below function, its not closing current tab instead it closed all the tabs. Please help me Image

window.open('', '_self').close();
         window.top.close();
         window.close();
728x90

2 Answers How to close the Current opened Tab and go back to previous (Parent) Tab

before you close the current tab, you need to open it using "window.open()". the window.close button works only the windows that opened by it.

6 days ago

You can close the current tab with this javascript line:

window.top.close();

But there are things that you should keep in mind:

  • This will only work if the tab is also opened programmatically.

    By using window.open();, you can close the opened tab with the javascript line above.

  • Not all browsers support this solution

You can also visit this link for reference. I hope this helps.

6 days ago