How can I retrieve the java script function value from a web page loaded withing a webview component??
+1
A:
You can't, directly.
You can call the Javascript function via loadUrl("javascript:...")
, where ...
is your function call. However, you cannot get a result this way.
If you inject a Java object into the Web page via addJavascriptInterface()
, you could set up another function that called the function you want and returns that value via a call to the injected Java object. That only works if you can modify the Web page, though.
CommonsWare
2010-02-17 13:03:09
Hi, Thanks for the reply. could you share some sample code that uses the above concept. Im not really clear what its trying to do.Thanks again in advance.
Funkyidol
2010-02-18 07:07:17
http://github.com/commonsguy/cw-advandroid/tree/master/WebView/
CommonsWare
2010-02-18 13:05:33