I am looking for a way to check if a device supports DeviceOrientationEvent or DeviceMotionEvent. To be more precise, I do not know if the device really has an accelerometer .
Unfortunately, window.DeviceMotionEvent and window.ondevicemotion respectively window.DeviceOrientationEvent and window.ondeviceorientation exist, although the device - MacBook Retina - does not have an accelerometer.
It is clear to me that if an event never fires, the eventlistener callback function will never fire either. But in my case, I, my program should know if the device has an accelerometer, because the user should receive a notification if there is no accelerometer.
The answers to this post, unfortunately, did not help my problem.
source share