javascriptで開かれていないが、同じフォルダにあるアクティブなタブ(htmlまたはphpファイル)を閉じることはできますか?アクティブなタブをJavascriptで閉じるには?
どのようにすればよいですか?
var activeTab = null; //set activeTab into null
function openWin() {
activeTab = window.open("/Test.php", "_blank");
} // i set this function to store the active browser located in the same folder
window.alert('Succesfully Updated') //pop up successfull
openWin.close(); //close the activeTab first before closing the window
window.close();
あなたはすでにwindow.close()を使用しています –
いいえ、スクリプトがそれを開いていない場合、ウィンドウ/タブを閉じることはできません。 – Barmar
'openWin.close()'は 'activeTab.close()'でなければなりません。 'openWin'は関数であり、ウィンドウを保持する変数ではありません。 – Barmar