I'm trying to use Generic Sensor API(Gyroscope) in my project I've looked up for documentation on W3C and Intel Github and https://mobiforge.com/design-development/the-generic-sensor-api I've created/copied https://mobiforge.gitlab.io/sensors/gyroscope.html this HTML page to reference javascript it works fine when i open with this link or my github link: Screen Shot of my github page nishanksisodiya.github.io/gyro
But when i open it with a flask server running on my laptop it gives Gyroscope not supported error Screen Shot my localhost page
let status = document.getElementById('status');
if ( 'Gyroscope' in window ) {
let sensor = new Gyroscope();
sensor.addEventListener('reading', function(e) {
status.innerHTML = 'x: ' + e.target.x + '<br> y: ' + e.target.y + '<br> z: ' + e.target.z;
});
sensor.start();
}
else status.innerHTML = 'Gyroscope not supported';
here's the javascript i used. Any help would be appreciated.