anthony Posted August 27, 2013 Share Posted August 27, 2013 Hi folks, I've been trying to detect when a page in mobile Safari (iOS 6) on an iPad is not visible. My intention is that I can then pause a game and any audio that's playing. The Page Visibility API doesn't seem to work so I then tried adding event listeners for pageshow, pagehide but unfortunately I had no luck with that either. Has anyone dealt with this problem before and come up with a hack/solution? A half arsed idea I had as I was typing this is to monitor the elapsed time since the player last interacted with the page and if it's X seconds then pause. I don't know how reliable that would be and it's quite game specific. Thanks, Anthony Quote Link to comment Share on other sites More sharing options...
tyson Posted August 27, 2013 Share Posted August 27, 2013 Maybe this polyfill will work? https://gist.github.com/addyosmani/1122546 Quote Link to comment Share on other sites More sharing options...
anthony Posted August 27, 2013 Author Share Posted August 27, 2013 Thanks tyson, I'll give that a blast this evening. Quote Link to comment Share on other sites More sharing options...
jarbot Posted September 30, 2014 Share Posted September 30, 2014 Anthony, did you have any luck with that polyfill? Quote Link to comment Share on other sites More sharing options...
jarbot Posted September 30, 2014 Share Posted September 30, 2014 The polyfill did not work for me on ios 6.1.3 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.