网站 "minutesplease.com" 如何关闭我的 chrome window 中的选项卡?
How does the website "minutesplease.com" close tab in my chrome window?
网站“http://minutesplease.com/”做了一些我认为不可能的事情 - 它关闭了我的 chrome 中的一个标签(同样未经我的许可!)。
网站(不是扩展程序)怎么可能关闭我的 chrome window 中的标签页?到目前为止,我深信一个网站最多能做的就是停止向我提供数据包。在这种情况下,我只会收到连接错误,而不是制表符终止。此外,它不仅关闭了一个选项卡,还关闭了一个不属于他自己的选项卡 (!)。这个网站和标签页之间的唯一联系是它负责打开它。
源代码位于这个 javascript 文件中 => misc.js
该站点正在将新站点作为弹出窗口打开,然后在以下函数中使用 Javascript 关闭弹出窗口。
function killIt(i)
{
if(!popupWindow[i].closed) popupWindow[i].close();
stopCountDown(i);
}
所以它不是 window,只是让它看起来像 window :)
查看函数 popSite()
(粘贴在下面)以了解它如何打开新的 url 作为弹出窗口。
function popSite()
{
var url = fixUrl(document.getElementById("url").value);
var operaError = "In order to use this feature, you must allow popups for this site. Simply unblocking a blocked-popup will not do.";
try
{
var newWindow = window.open(url);
if (newWindow == null )
{
alert("In order to use this feature, you must allow popups for this site.");
return;
}
if (window.opera)
if (!newWindow.opera)
{
alert(operaError);
return;
}
}
catch(err)
{
//This is here to account for inexplicable behavior in opera
}
nOpenWindows++;
if(nOpenWindows == 1) updateInterval = setInterval("updateTime()",100);
newWindow.focus();
nWindows = popupWindow.push(newWindow);
var index = nWindows - 1;
alive[index] = true;
timeRequest[index] = toMilliseconds(document.getElementById("time").value);
var d = new Date();
popStart[index] = d.getTime();
//Create a new entry in the table of timed sites.
var templateCopy = document.getElementById("templateRow").cloneNode(true);
provideIds(templateCopy,index);
document.getElementById("siteList").appendChild(templateCopy);
if(removePrefix(url) =="") windowURL[index] = "BLANK"; else windowURL[index] = removePrefix(url).toUpperCase();
var siteLink = document.getElementById("site"+index);
siteLink.innerHTML = windowURL[index];
if (timeRequest[index] <= warningTime()) haveWarned[index] = 1; else haveWarned[index] = 0;
pauseTime[index] = 0;
alertWindow[index] = null;
alertWindowTimeout[index] = null;
//Now display it
templateCopy.style.display = "";
addToActiveList(index);
}
这是 "kills" window(即弹出窗口)
的代码
function killIt(i)
{
if(!popupWindow[i].closed) popupWindow[i].close();
stopCountDown(i);
}
网站“http://minutesplease.com/”做了一些我认为不可能的事情 - 它关闭了我的 chrome 中的一个标签(同样未经我的许可!)。
网站(不是扩展程序)怎么可能关闭我的 chrome window 中的标签页?到目前为止,我深信一个网站最多能做的就是停止向我提供数据包。在这种情况下,我只会收到连接错误,而不是制表符终止。此外,它不仅关闭了一个选项卡,还关闭了一个不属于他自己的选项卡 (!)。这个网站和标签页之间的唯一联系是它负责打开它。
源代码位于这个 javascript 文件中 => misc.js
该站点正在将新站点作为弹出窗口打开,然后在以下函数中使用 Javascript 关闭弹出窗口。
function killIt(i)
{
if(!popupWindow[i].closed) popupWindow[i].close();
stopCountDown(i);
}
所以它不是 window,只是让它看起来像 window :)
查看函数 popSite()
(粘贴在下面)以了解它如何打开新的 url 作为弹出窗口。
function popSite()
{
var url = fixUrl(document.getElementById("url").value);
var operaError = "In order to use this feature, you must allow popups for this site. Simply unblocking a blocked-popup will not do.";
try
{
var newWindow = window.open(url);
if (newWindow == null )
{
alert("In order to use this feature, you must allow popups for this site.");
return;
}
if (window.opera)
if (!newWindow.opera)
{
alert(operaError);
return;
}
}
catch(err)
{
//This is here to account for inexplicable behavior in opera
}
nOpenWindows++;
if(nOpenWindows == 1) updateInterval = setInterval("updateTime()",100);
newWindow.focus();
nWindows = popupWindow.push(newWindow);
var index = nWindows - 1;
alive[index] = true;
timeRequest[index] = toMilliseconds(document.getElementById("time").value);
var d = new Date();
popStart[index] = d.getTime();
//Create a new entry in the table of timed sites.
var templateCopy = document.getElementById("templateRow").cloneNode(true);
provideIds(templateCopy,index);
document.getElementById("siteList").appendChild(templateCopy);
if(removePrefix(url) =="") windowURL[index] = "BLANK"; else windowURL[index] = removePrefix(url).toUpperCase();
var siteLink = document.getElementById("site"+index);
siteLink.innerHTML = windowURL[index];
if (timeRequest[index] <= warningTime()) haveWarned[index] = 1; else haveWarned[index] = 0;
pauseTime[index] = 0;
alertWindow[index] = null;
alertWindowTimeout[index] = null;
//Now display it
templateCopy.style.display = "";
addToActiveList(index);
}
这是 "kills" window(即弹出窗口)
的代码 function killIt(i)
{
if(!popupWindow[i].closed) popupWindow[i].close();
stopCountDown(i);
}