问题
Unfortunately Safari disables Motion and Orientation access by default in:
Settings > Safari > Privacy & Security > Motion & Orientation Access
So what I'm trying to figure out is if it's possible to detect whether the user has this setting enabled or not. Is there a property on the window object in the browser that informs me that it's enabled?
I've tried looking up the solution on StackOverflow and various other places but they're either outdated or just don't work.
回答1:
You could use the window.orientation property (output will be in degrees), since it is supported in Safari for IOS
Note: Its use is depreciated and is not supported in many of the other browsers, fore other browsers you should use the screen.orientation property or the Generic Sensors API
来源:https://stackoverflow.com/questions/56533863/detect-whether-motion-orientation-access-is-enabled-in-javascript-ios