How to close all browser tabs using JavaScript
Loading
How to close all browser tabs using JavaScript
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Deepak RawatPosted May 3, 2023, 12:05 PM
This approach is only allowed for windows that were opened by a script, so it won't work for tabs that were opened manually by the user. Here's an example code snippet:
this code will only work in certain situations, such as when all tabs were opened by the same script. It may not be able to close all tabs in all scenarios, especially if they were opened manually by the user. Additionally, some browsers may block the
window.close()method to prevent abuse by malicious websites.Jignesh KumarPosted Mar 31, 2023, 9:24 AM
Hello Hiren,
You can try this one,
Rajkiran SwainPosted Mar 31, 2023, 7:40 AM