【问题标题】:Detect Jquery blur event on window with 100width and height iframe in it?检测窗口上具有 100 宽度和高度 iframe 的 Jquery 模糊事件?
【发布时间】:2016-04-22 16:28:00
【问题描述】:

我的网站是包含 100% iframe 的网站。 在 iframe 中打开不同的外部链接。 在 iframe 中打开的某些页面具有以下链接 在新窗口中打开(在 iframe 之外)。

我想提醒用户他们将离开我的域,例如。 离开 iframe。

我尝试了很多关于 window.blur 事件的示例。 但是因为焦点一直在 iframe(iframe 中的页面)上,所以什么都没有 对我有用。

我只想检测 iframe 中外部链接的新窗口何时发生 并做一些事情。

我是新手,所以请理解我。

谢谢!

【问题讨论】:

    标签: iframe detect onblur


    【解决方案1】:

    小提琴:http://jsbin.com/fisitotehi/edit?html,js,output

    我想提醒用户他们将离开我的域,例如。离开 框架。

    window.onbeforeunload = function() {
      return 'Are you sure you want to leave?';
    };
    

    【讨论】:

    • 感谢您的回复,但它仅适用于关闭窗口而不适用于打开的新标签。
    猜你喜欢
    • 2016-08-09
    • 2013-01-02
    • 2011-12-10
    • 1970-01-01
    • 1970-01-01
    • 2012-05-31
    • 2016-05-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多