简体   繁体   English

在iOS 12.2上的safari中使用JavaScript请求动态访问

[英]Request motion access with JavaScript in safari on iOS 12.2

In iOS 12.2, apple added a new “feature” where motion and orientation access in safari is disabled by default. 在iOS 12.2中,apple添加了一个新的“功能”,默认情况下禁用safari中的运动和方向访问。 Is there a way to use JavaScript to access this option (or trigger a system pop-up that the user can say yes or no to that will enable access) so the user doesn't have to manually enable it? 有没有办法使用JavaScript来访问此选项(或触发用户可以说是或否的系统弹出窗口,以启用访问),这样用户不必手动启用它?

Not yet. 还没。

"The only solution right now is to show a message to user to go to Settings and enable feature before some of the events are started (such as deviceorientation). “现在唯一的解决方案是向用户显示一条消息,以便在启动某些事件(例如deviceorientation)之前转到”设置“并启用功能。

There is an API coming to request permission per site, but the WebKit team didn't have time to get it done for this release. 每个站点都有一个API来请求权限,但WebKit团队没有时间为此版本完成任务。 Chris Dumez from Apple confirmed that." 来自Apple的Chris Dumez证实了这一点。“

https://medium.com/@firt/whats-new-on-ios-12-2-for-progressive-web-apps-75c348f8e945 https://medium.com/@firt/whats-new-on-ios-12-2-for-progressive-web-apps-75c348f8e945

theres no official way yet, but you can probably do something like this (user will still have to manually enable it but at least you can tell them whats going on): 还没有正式的方法,但你可能会做这样的事情(用户仍然需要手动启用它,但至少你可以告诉他们最新情况):

https://github.com/w3c/deviceorientation/issues/57 https://github.com/w3c/deviceorientation/issues/57

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM