In iOS 13 Apple has introduced the API DeviceOrientationEvent.requestPermission. It must be triggered on user action (click, tap or equivalent). My problem here is that the result seems to be cached, so in case the user denies permission I can't ask access again (the promise is automatically fulfilled with the cached value). Is there any way to force the device to forgot the cached value and ask again for the user permission to access orientation data (I mean it should display again the popup window where the user can allow or deny access)?
This is the relevant code:
if (DeviceOrientationEvent && typeof(DeviceOrientationEvent.requestPermission) === "function") {
const permissionState = await DeviceOrientationEvent.requestPermission();
if (permissionState === "granted") {
// Permission granted
} else {
// Permission denied
}
}
I see the same behavior on iOS 13 Safari. You need to remove the website data for the particular site that needs permission. Go to Settings > Safari > Advanced > Website data, lookup the site and remove all the data. Then the prompt should show up again when you ask for permission.
Try simply to quit Safari and launch it back. The prompt will come back.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With