//if this is the link, return false
var tab = window.open("https://www.google.com.vn/", "_blank");
// if this is the link, reture true
// var tab = window.open("https://www.google.com/search?q=coin&oq=coin&aqs=chrome..69i57j0i131i433i512j0i433i512l2j46i131i199i433i465i512j0i131i433i512j46i131i199i433i465i512j0i131i433i512j0i433i512j0i512.665j0j15&sourceid=chrome&ie=UTF-8", "_blank");
// I want to know why it is true and how to fix it
setInterval(function() {
checkTabsClosed()
}, 3000);
function checkTabsClosed() {
console.log(tab);
if (tab && tab.closed) {
console.log("close");
} else
console.log("open");
}