Windows 10 will reach EOS (end of support) on October 14, 2025. For more information, see this article.

Prohledat stránky podpory

Vyhněte se podvodům. Za účelem poskytnutí podpory vás nikdy nežádáme, abyste zavolali nebo poslali SMS na nějaké telefonní číslo nebo abyste sdělili své osobní údaje. Jakékoliv podezřelé chování nám prosím nahlaste pomocí odkazu „Nahlásit zneužití“.

Zjistit více

How to close a tab using javascript? window.close() doesnt work here.

  • 1 odpověď
  • 4 mají tento problém
  • 1 zobrazení
  • Poslední odpověď od cor-el

more options

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(); }

Všechny odpovědi (1)

more options

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.