Issue
Is there a way to manipulate the loaded HTML or just run custom JavaScript over a loaded webpage?
I do not have access to the server I am loading from so I do not have that option.
Solution
Call loadUrl("javascript:<your JS here>");
on the webview.
As of 4.4, you can also call the method evaluateJavascript(String script, ValueCallback<String> resultCallback)
that will do a much nicer job. loadUrl
will execute asynchronously with no return value (you have to jump through a lot of hoops in order to get a value back, including setting up a Java<->JS bridge and using thread synchronization in order to get a result). evaluateJavascript
still executes asynchronously but the provided callback will be executed on the UI thread and is a much, much nicer way to go about things.
Answered By - tophyr
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.