The Sensor API only works on devices which have the sensors and provide access to them, and when served via HTTPS.
The Sensor API isn't supported on Safari on iOS.