【发布时间】:2014-06-07 14:45:36
【问题描述】:
我正在尝试使用 Page Visibility Api 来检测 Web 内容何时在 iOS 中显示。我有简单的 JS:
window.addEventListener("pageshow", function(){ alert("page shown"); }, false);
The alert fires as expected in mobile safari when the tab is made active, or when safari is minimized and then re-shown.
但是,如果我在 UiWebView 中托管 Web 内容,则不会触发该事件。有没有其他人遇到过这个问题?如果是这样,有什么解决方法吗?
谢谢...
【问题讨论】:
-
对于任何想要查看触发的浏览器事件的人,这里有一个事件测试器:jsbin.com/runed/5 - 我怀疑可能有一种方法可以使用 setInterval 或 webkitRequestAnimationFrame 来检测页面何时显示。
标签: javascript ios html uiwebview mobile-safari