I have this very simple code, based on MDN, to check the device orientation:
const message = document.getElementById("message");
message.textContent = "Start";
document.querySelector("body").addEventListener("click", () => {
message.textContent = "Clicked";
window.addEventListener('deviceorientation', function(event) {
message.textContent = "Triggered";
});
});
It is served from a https server. (You can try it here: erikpineiro.se/ori)
It works on Chrome on an Android device (haven't tested other browsers) but it does not work on any of my browsers (Safari, Chrome, Firefox) on IOS (14.7) (tested from an iPhone 8).
Thankful for any tips as to why this might be.
PS: I have read this question but trying to include
DeviceOrientationEvent.requestPermission();
ends up in the error "DeviceOrientationEvent.requestPermission is not a function"