WebView Troubleshooting
Application Webview Test
To facilitate the integration of the SignBook solution into a mobile webview, we recommend using the official Webview Test application, available on the Google Play Store or for Iphones on the Apple App Store.
This application allows you to test and diagnose SignBook compatibility in a secure webview environment. In case of difficulties, it helps determine whether the issue comes from your mobile application or the device itself.
By isolating the webview, Webview Test allows you to quickly identify the source of errors, simplifying the debugging process.
Problem with input to upload files directly from the camera in Android WebView
Html inputFile element does not work with camera to take shot photo and select this file to pass it to the html form, it is not supported by Android Webview.
Solution
It is necessary to add in the manifest.xml:
<intent>
<action android:name='android.intent.action.GET_CONTENT' />
<data android:mimeType='image/jpeg' />
</intent>
and globally make sure you have this lines
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="mypackage">
<queries>
<!-- Camera --><intent><action android:name="android.media.action.IMAGE_CAPTURE" /></intent>
<!-- Gallery --><intent><action android:name="android.intent.action.GET_CONTENT" /></intent>
</queries>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.INTERNET"/>
...
</manifest>
Problem with opening popup window
Cannot open new window popup in WebView.
Solution
To solve this problem, you can use the following methods:
- Try adding settings in your mobile application
WebSettings webSettings = webViewPage.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setSupportMultipleWindows(true);
webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
- Use redirect instead of opening popup, but it is a workaround
Problem with playsinline attribute when using video identification
This attribute tells the browser not to play the video in full screen mode.
Unfortunately, the attribute of html video element playsinline is not supported by certain version of WebKit Webview on IOS iphones.
Solution
WebKit WebView (WKWebView) on Iphone does not support video playback in the intended location https://developer.mozilla.org/fr/docs/Web/HTML/Element/video#playsinline. To solve this problem, you can use the following methods:
- Update the IOS SDK used to forge the mobile application.
- Configure WKWebView by adding the parameter
allowsInlineMediaPlayback
totrue
in theWKWebViewConfiguration
object. - Use Safari WebView rather than WKWebView, there are several types of webview on Iphone (WKWebView, UIWebView and SafariWebView).
Problem with camera in FaceMatch photo screen is black
WebView does not support automatic playback of the camera's video stream with the “autoplay” attribute
Solution
This must be explicitly enabled in the WebView settings:
myWebView.getSettings().setMediaPlaybackRequiresUserGesture(false);