如何关闭具有特定标题的所有网页?
How do you close all webpages with a certain title?
我的 [网站]:http://www.zombrom.com/experiments/popular.html 有一个自动 re-loader 并且每次重新加载时它都会重新打开页面 我想知道如何一次关闭所有这些网站这是我当前的代码它不会打开更多网站:
setInterval(function() {
location.reload();
window.open("http://www.zombrom.com/experiments/popular.html");
}, 1000);
<center><b>Ready!</b>
</center>
你可以使用 window.close()
var openWindows = [], newWindow;
setInterval(function() {
/* Will not work with location.realod() */
//location.reload();
//push reference to the opened windows into an array
newWindow = window.open("http://www.zombrom.com/experiments/popular.html");
openWindows.push(newWindow);
}, 1000);
/* call this function when you want to close all the windows that you have opened*/
function closeAllOpenWindows(){
openWindows.forEach(function(openWindow){
openWindow.close();
}
);
}
我的 [网站]:http://www.zombrom.com/experiments/popular.html 有一个自动 re-loader 并且每次重新加载时它都会重新打开页面 我想知道如何一次关闭所有这些网站这是我当前的代码它不会打开更多网站:
setInterval(function() {
location.reload();
window.open("http://www.zombrom.com/experiments/popular.html");
}, 1000);
<center><b>Ready!</b>
</center>
你可以使用 window.close()
var openWindows = [], newWindow;
setInterval(function() {
/* Will not work with location.realod() */
//location.reload();
//push reference to the opened windows into an array
newWindow = window.open("http://www.zombrom.com/experiments/popular.html");
openWindows.push(newWindow);
}, 1000);
/* call this function when you want to close all the windows that you have opened*/
function closeAllOpenWindows(){
openWindows.forEach(function(openWindow){
openWindow.close();
}
);
}