Low Power Mode Detection in JavaScript for iOS11

Hide iOS Safari Native low-power Play Button

Found this sandbox: https://codesandbox.io/s/relaxed-franklin-h2zkhl?file=/src/scripts/index.ts:0-87

Apparently you can set a setTimeout to autoplay without an autoplay attribute.

It will throw an error on low power mode, but that can of course be caught.

Is it possible to access a mobile devices battery status or charge via a web browser api?

Thanks Tapani and Michael,

Your help definitely pointed me in the right direction. With the info you provided I was able to find more info on the spec and what browsers support the api.

  • Chrome 42.0.2311.90 (64-bit) does not seem to support the battery API.
  • Chromium Version 22.0.1225.0 (149762) also does not support the battery API.
  • Chrome Canary Version 44.0.2387.0 canary (64-bit) supports the spec on MDN (https://developer.mozilla.org/en-US/docs/Web/API/Battery_Status_API) but does not support the navigator.battery namespace.
  • Firefox supports the navigator.battery namespace but does not support the navigator.getBattery() function.
  • Safari Version 8.0.5 (10600.5.17) doesn't support anything referring to the battery api that I can tell.

I didn't get around to checking this on mobile but I don't suspect that mobile browsers would be more consistent api or even have it implemented better than any of the above browsers. Seems fairly new and the browsers organizations are still trying to figure out and are struggling to follow the documented spec. Reminds me a bit of CSS flex-box a bit.

Thanks guys!

Background video not auto playing on safari browser used svelte to build the website

The video is encoded by AV1 which is not supported by Safari entire apple ecosystem and Firefox on Android source



Related Topics



Leave a reply



Submit