Method of android about webview loading h5 web page opening and positioning
- 2021-09-24 23:40:56
- OfStack
As shown below:
//webview Locate related settings
settings.setDomStorageEnabled(true);
settings.setGeolocationEnabled(true);
//settings.setGeolocationDatabasePath(getFilesDir().getPath());
progressWebView.setWebChromeClient(new WebChromeClient() {
@Override
public void onGeolocationPermissionsShowPrompt(String origin, Callback callback) {
callback.invoke(origin, true, true);
super.onGeolocationPermissionsShowPrompt(origin, callback);
}
});
Add the above code to solve the problem that h5 page cannot be located!