Prevent a device from going to sleep when browsing a web page

I would like to prevent the device going to sleep while looking at my web page. I would like this to work for chrome and safari on both ios and andriod.

I have currently researched 2 possible options for this.

  1. Wavelock API This seems promising as the browser supports it natively. But does does not seem to be supported by many browsers just yet. Has anyone had succsess with this yet?
  2. NoSleep.js Seems widely used, but has many open issues and worried it will fall into disrepair. It seems to work by playing a video on the webapge.

The question I have are.

Has anyone had success with either of the above?

and

Is there other options I have not considered which you would reccomend?