Vibration API #22

Open
opened 2024-07-19 13:26:49 +00:00 by novaotp · 0 comments
novaotp commented 2024-07-19 13:26:49 +00:00 (Migrated from github.com)

Putting it here because else I'll forget it.

Checking if the method vibrate exists on the navigator object isn't reliable since it's implemented everywhere, even if it has no effect. Moreover, Firefox on Android denies the permission so I also have to check that.

Any suggestions on how to reliably check if the vibrate method actually works on the device and fallback to sound if not and/or detecting the browser like Firefox for Android ? (I'm aware that checking the UA is neither reliable nor recommended so I'm curious to know if there are alternatives)

_Putting it here because else I'll forget it._ Checking if the method `vibrate` exists on the navigator object isn't reliable since it's implemented everywhere, even if [it has no effect](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/vibrate). Moreover, Firefox on Android [denies the permission](https://bugzilla.mozilla.org/show_bug.cgi?id=1653318) so I also have to check that. Any suggestions on how to reliably check if the `vibrate` method actually works on the device and fallback to sound if not and/or detecting the browser like Firefox for Android ? (I'm aware that checking the [UA is neither reliable nor recommended](https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent#considerations_before_using_browser_detection) so I'm curious to know if there are alternatives)
Commenting is not possible because the repository is archived.
No description provided.