Preventing annoying HTML5 geolocation alerts insid

2019-02-04 15:09发布

Whenever an script requests the geolocation using HTML5's geolocation API, the UIWebView asks for a permission to use the iOS location services.

This is pretty annoying, specially when you load static HTML files, it keeps asking the permission for each file, even if the user already granted this permission for the app itself.

Is there a way to prevent it?

I know that on safari the permission for geolocation is based on the domain and I agree on asking for permission when the request is done for a different domain, but shouldn't the UIWebView have the same geolocation permission as the app when loading static HTML or local files?

Am I doing something wrong?

UIAlertView requesting permission for domain

1条回答
该账号已被封号
2楼-- · 2019-02-04 15:41

You can always pass the geolocation from your app to the javascript loaded into the WebUIView. Look for 'stringByEvaluatingJavaScriptFromString' in WebUIView?

查看更多
登录 后发表回答