http://www.takeafive.com/这个网站是咋做到关闭浏览器的其它标签页的?

这个是网站的javascript部分代码: 【http://www.takeafive.com/这个网站是咋做到关闭浏览器的其它标签页的?】 http://www.takeafive.com/这个网站是咋做到关闭浏览器的其它标签页的?

function OpenInNewTab() { var fiveMinutes = 60 * document.getElementById(\u0026#39;userInput\u0026#39;).value, display = document.querySelector(\u0026#39;#time\u0026#39;); startTimer(fiveMinutes, display); var w1 = window.open("hurry.html", \u0026#39;_blank\u0026#39;); var time = document.getElementById("userInput").value*60000;window.setTimeout(function(){window.location.href="https://www.zhihu.com/api/v4/questions/36962932/timesup.html"; }, time);window.setTimeout(function(){w1.window.location.href="https://www.zhihu.com/api/v4/questions/36962932/closeit.html"; }, time); document.getElementById("hi").style.visibility = "visible";document.getElementById("myButton").style.visibility = "hidden"; document.getElementById("userInput").style.visibility = "hidden"; document.getElementById("yo").style.visibility = "hidden"; document.getElementById("ay").style.visibility = "hidden"; document.getElementById("ja").style.visibility = "hidden"; document.getElementById("ha").style.visibility = "hidden"; document.getElementById("sa").style.visibility = "hidden";onunload = function() {w1.location.href="https://www.zhihu.com/api/v4/questions/36962932/closeit.html"};\t};javascript有一个很重要的机制就是,javascript只能关闭由它打开的网页,做到这个不难,我的第一个想法就是加一个定时器,其实你不用担心有什么问题,你打开的其他网页,它是干预不了的。
■网友
window.open() returns a Window object which can be closed.


    推荐阅读