I am trying to load webviews in a view pager.
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanc
I was getting Uncaught Reference Error: JavascriptInterfaceName is not defined
on every second startup of my hybrid application on 4.3 and below, and so I did this thanks to @Abi in my WebChromeClient
class:
@Override
@SuppressLint({"AddJavascriptInterface", "InflateParams"})
public boolean onConsoleMessage(@NonNull ConsoleMessage consoleMessage) {
if("Uncaught ReferenceError: JavascriptInterfaceName is not defined".equals(consoleMessage.message())) {
webView.addJavascriptInterface(new WebAppInterface(), "JavascriptInterfaceName ");
webView.reload();
}
return super.onConsoleMessage(consoleMessage);
}
And it works! Thank you very much!