Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 检测覆盖iframe的系统窗口_Javascript_Html_Iframe_Optimization_Render - Fatal编程技术网

Javascript 检测覆盖iframe的系统窗口

Javascript 检测覆盖iframe的系统窗口,javascript,html,iframe,optimization,render,Javascript,Html,Iframe,Optimization,Render,在看了之后,我很好奇所显示的一些特性是如何用JS实现的 我的一个主要问题是如何在iframe上检测另一个系统窗口(如视频中显示的单词窗口) 在上,有一个提示表明该技术基于浏览器优化视图外元素的渲染这一事实 我无法了解所使用的确切方法/属性 你的想法是什么 据我所知,可以检测页面是在前台还是在后台,或者更准确地说,是有焦点还是没有焦点 var focus=true; window.onblur=function(){focus=false;action();} window.onfocus=fu

在看了之后,我很好奇所显示的一些特性是如何用JS实现的

我的一个主要问题是如何在iframe上检测另一个系统窗口(如视频中显示的单词窗口)

在上,有一个提示表明该技术基于浏览器优化视图外元素的渲染这一事实

我无法了解所使用的确切方法/属性


你的想法是什么

据我所知,可以检测页面是在前台还是在后台,或者更准确地说,是有焦点还是没有焦点

var focus=true;
window.onblur=function(){focus=false;action();}
window.onfocus=function(){focus=true;action();}
document.onblur=window.onblur;
document.focus=window.focus;
函数动作(){
如果(焦点){
document.body.style.background=“绿色”;
}否则{
document.body.style.background=“浅灰色”;
}
}

尝试单击内部然后单击外部
您必须检查
文档。焦点
以及窗口和屏幕监视器的位置/大小

也许是这样:

您可以在此处尝试我的演示:

let bool=document.hasFocus();
$(“p.info”)。文本(“in”);
console.log(外径+屏幕X)
if(screen.width
也:
  • 您可以比较两个设置间隔之间的时间
    (+new Date())
    ,以检测非活动浏览器
该视频已有4年历史,因此,如果它是一个被修补的漏洞,那么它可能就不可能再存在了。spider.io是谷歌购买的,代码仍然处于活动状态。请查看此处谢谢,您提供了很好的信息(对我来说并不是什么新鲜事)。。。如果不可能,您可以尝试猜测他们使用的方法是什么吗?可以确认:requestAnimationFrame调用中没有明显的差异,只是根据视口坐标而不是实际重叠来减慢执行速度。广告可能是用adobe flash制作的。非常令人印象深刻的演示,但是这不会与其他应用程序窗口一起使用(比如像word)@RoniGadot我不确定你的视频是纯javascript还是真实的。其他开发人员也会发现同样的东西。我希望我的答案对你有所帮助,但在javascript中我们做不了更多。@Hors Sujet,这段视频是由Google获得的spider.io制作的,所以我猜它是真实的。我很好奇技术是什么。奇怪的是,只有一个人发现了它t、 …这可能是浏览器的问题:
let bool = document.hasFocus();

$("p.info").text("in");
console.log(outerWidth + screenX)
if (screen.width < outerWidth + screenX) {
    bool = false;
    $("p.info").text("right side: out");
} else if ((outerWidth - innerWidth) + screenX < 0) {
    bool = false;
    $("p.info").text("left side: out");
} else if (screen.height < outerHeight + screenY) {
    bool = false;
    $("p.info").text("bottom side: out");
} else if ((outerHeight - innerHeight) + screenY < 0) {
    bool = false;
    $("p.info").text("top side: out");
}

if (currentChild && !currentChild.closed) {  
    let rectPage = {
        left:   (outerWidth - innerWidth) + screenX,
        top:    (outerHeight - innerHeight) + screenY,
        right:  outerWidth + screenX,
        bottom: outerHeight + screenY
    };

    let rectPopup = {
        left:   currentChild.screenX,
        top:    currentChild.screenY,
        right:  currentChild.outerWidth + currentChild.screenX,
        bottom: currentChild.outerHeight + currentChild.screenY
    }; 
    if (intersectRect(rectPage, rectPopup)) {
        $("p.info").text("eclipse with popup");
        bool = false;
    }
}
$page.text(pin(bool));