📌  相关文章
📜  javascript 关闭当前选项卡 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:51.028000             🧑  作者: Mango

代码示例2
// IF you use in a button

// if you use in function
function closeWin() {
  myWindow.close();   // Closes the new window
}
// But it will only work when you open a window through your code like this
function openWin() {
  myWindow = window.open("", "myWindow", "width=200, height=100");   // Opens a new window
}
// You can't close the current window that was open by browser. beacuse browser don't give permission for this