Send message to javascript

I am using Cordova-Android (PhoneGap). I am extending the CordovaWebViewClient class by overriding the shouldOverrideUrlLoading method. I need to send javascript to a view. I tried this, but it does not work:

  @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { if (isNetworkAvailable()) { sendJavascript("javascript:alert('OK')"); return false; } else { sendJavascript("javascript:alert('NO')"); return true; } } 

What am I doing wrong? Any help?

Thanks in advance.

0
source share

Source: https://habr.com/ru/post/1435284/


All Articles