How to close tab in Chrome and Edge in fist time using JavaScript?

Viewed 46

I want to use javascript to close tab in chrome, but I found that the first time I open the chrome browser,and I use javascript code as below.

window.open('','_self'); window.close();

I can't close it, but it works again when I try again. The tab that I opened the browser first time cannot be closed, then I try again and it works again.

What's going on? How can I close tab in first time?

0 Answers
Related