NoSleep.js
NoSleep.js copied to clipboard
not working with apple-mobile-web-app-capable
it was not working for the web app i'm designing, so in an attempt to problem solve I cloned the example site, and added :
<meta name="apple-mobile-web-app-capable" content="yes">
I opened the site on device with ios 9, saved it to home screen, opened it, clicked the button, and device went to sleep after standard time. (same behaviour on android)
@richtr Do you have any idea whether or not this is fixable?
I was able to get NoSleep working when launched from the home screen - at least it works on iOS 12.
I am having the same issue. It ONLY works right after I added the app to the homescreen, but it doesn’t if I close and open it again.
Edit: It’s getting more interesting, I actually have that same problem if I do not add it to my homescreen, if I re-open iOS safari (without doing a hard reload) it doesn’t work anymore... I have the idea the dummy video is “stuck” or not able to play anymore.
Edit2: did some more investigating, it seems it’s actually working always if I reconstruct nosleep before enabling it every time, so like
let nosleep = null;
function enable() {
if (nosleep) nosleep.disable(); // Just to be sure if you forgot to disable.
nosleep = new NoSleep();
nosleep.enable();
}
function disable() {
nosleep.disable();
}
It seems to fix the problems I had, but I’m just giving the information I now have, I’m not sure if it’s the actual solution.