简体   繁体   English

使用Chrome的JavaScript控制台关闭特定网站的所有标签

[英]Closing all tabs of a specific website using Chrome's JavaScript Console

是否可以使用Chrome的JavaScript控制台关闭特定网站或URL /标题正则表达式的所有标签,例如关闭数十个正在消耗内存的Stackoverflow标签,而不是一个一个地关闭它们?

This is not possible to do with the JavaScript console. JavaScript控制台无法做到这一点。 The JavaScript console has no way of interacting with the browser in this fashion. JavaScript控制台无法以这种方式与浏览器进行交互。

Just tried this and it seems to work in Chrome. 刚刚尝试过,它似乎可以在Chrome浏览器中使用。 Although it does mean that you have to programmatically open the window as well: 尽管这确实意味着您还必须以编程方式打开窗口:

mywindow = window.open('', 'windowName', '', true);

then you close it with: 然后用以下命令关闭它:

mywindow.close();

See this answer . 看到这个答案 Basically you need a reference to do what you're doing. 基本上,您需要参考才能完成自己的工作。 You can't find by title or URL. 您无法按标题或URL查找。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用javascript在firefox-addon中关闭具有特定meta TAG的标签 - Closing tabs with a specific meta TAG in firefox-addon using javascript Chrome控制台的Javascript帮助吗? 单击所有链接网站 - Javascript Help For Chrome Console? Clicking All links website javascript关闭所有其他浏览器标签或子标签 - javascript closing all other browser tabs or child tabs 使用 javascript 控制台更改谷歌浏览器中的所有链接 - Changing all links in google chrome using javascript console 使用 javascript 从 chrome 控制台抓取一个网站 - Scrape a website from chrome console with javascript 如何使用Google Chrome浏览器的控制台执行click()? (JavaScript)的 - How to perform a click() using Google Chrome's Console? (Javascript) 使用Javascript for Chrome Extension检查其他网站上的所有框的问题 - Problems checking all boxes on another website using Javascript for Chrome Extension 使用 JavaScript 关闭 chrome 扩展通知 - Closing a chrome-extension notification using JavaScript Chrome控制台JavaScript中是否显示所有错误? - Are all errors shown in the Chrome console JavaScript errors? Google chrome select Javascript 或控制台的所有复选框 - Google chrome select All checkbox by Javascript or console
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM