How to close a tab using javascript? window.close() doesnt work here.
I am using the following function to close current tab.
function closeWindow() {
window.open("", "_self");
window.close();
}
I am using the following function to close current tab.
function closeWindow() {
window.open("", "_self");
window.close();
}
Alle antwurden (1)
You can only close windows that way that are opened via window.open()
This method is only allowed to be called for windows that were opened by a script using the window.open() method. If the window was not opened by a script, the following error appears in the JavaScript Console: Scripts may not close windows that were not opened by script.