【问题标题】:$(window).on('focus', ..) function not working on android chrome browser (working fine on firefox android)$(window).on('focus', ..) 函数在 android chrome 浏览器上不起作用(在 firefox android 上工作正常)
【发布时间】:2017-05-04 13:53:54
【问题描述】:

当标签专注于桌面和移动浏览器时,我必须触发页面重新加载事件。我正在使用 $(window).on('focus', ..) ,它在桌面上的 firefox 和 chrome 以及 android 上的 firefox 上运行良好,但在 chrome 上却不行。请为此提出解决方案。

【问题讨论】:

    标签: android jquery google-chrome


    【解决方案1】:

    尽量关注document,而不是window

    编辑 1 - 添加答案 尝试以原生方式添加事件监听器:

    window.addEventListener("focus", function() { 
       alert(1); 
    });
    

    【讨论】:

    • 试试吧:window.addEventListener("focus", function() { alert(1) });
    猜你喜欢
    • 2015-03-04
    • 1970-01-01
    • 2020-11-27
    • 2014-10-13
    • 2011-11-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-14
    相关资源
    最近更新 更多