WebView Support
- 20 Nov 2024
- 1 Minute To Read
-
Print
-
DarkLight
-
PDF
WebView Support
- Updated On 20 Nov 2024
- 1 Minute To Read
-
Print
-
DarkLight
-
PDF
Article summary
Did you find this summary helpful?
Thank you for your feedback
your title goes here
Chrome tabs are not supported as it doesn't support JavaScript injection.
If you want Whatfix Mobile to run in the Activity/Fragment which contains WebView then you add the following code:
your title goes here
Ensure that you call the following code before WebView loadUrl() method.
Leap.enableWeb(yourWebViewInstance);
WebView Scaling Support
If you have scaling enabled in your WebView, make sure you send the new scale to Whatfix Mobile SDK. You can get the new scale value of the WebView by overriding onScaleChanged() method in your WebViewClient.
Use the following code to get the new scale of the WebView:
Java
webViewInstance.setWebViewClient(new WebViewClient() {
@Override
public void onScaleChanged(WebView view, float oldScale, float newScale) {
super.onScaleChanged(view, oldScale, newScale);
//Required in LeapCreator to create the exp. in scaled WebView
LeapCreator.updateWebViewScale(newScale);
//Required in Leap to show the exp. in scaled WebView
Leap.updateWebViewScale(newScale);
}
});
Kotlin
webViewInstance.webViewClient = object : WebViewClient() {
override fun onScaleChanged(view: WebView, oldScale: Float, newScale: Float) {
super.onScaleChanged(view, oldScale, newScale)
//Required in LeapCreator to create the exp. in scaled WebView
LeapCreator.updateWebViewScale(newScale)
//Required in Leap to show the exp. in scaled WebView
Leap.updateWebViewScale(newScale)
}
}
Was this article helpful?