4

How can I retrieve the Javascript function value from a web page loaded withing a webview component??

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.