Is there any way the application perform a certain function depending on the open page in webview? Eg detecting some javascript in it?
Is there any way the application perform a certain function depending on the open
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This part of the Android docs will likely be helpful: http://developer.android.com/guide/webapps/webview.html#UsingJavaScript
You can call javascript on the WebView by using loadUrl(). For example:
The page can also pass data back up to Java code by using a Javascript Interface. Create a public class with public methods. Then, create an instance of that class and install it with webView.addJavascriptInterface()
For example
If you need to see if a certain javascript method is available or if you need to read from the DOM, you can use loadUrl to call some javascript that can do those look ups for you. Then you can use a javascript interface to call a Java method with some sort of response.