<h2>回复内容:</h2> iOS 上利用后端 JS 不执行的特性,加一个心跳机制,判断超时即在后台<br><div class="highlight"><div class="code" style="position:relative; padding:0px; margin:0px;"><pre><code class="language-text">var lastFired = new Date().getTime(); setInterval(function() { now = new Date().getTime(); if(now - lastFired > 5000) { // if it's been more than 5 seconds alert("onfocus"); } lastFired = now; }, 500); </code></pre><div class="contentsignin">登入後複製</div></div></div>