I wonder if it's possible to obtain Javascript variable value from Java code. In other words, I've got JS code in WebView and I need to be able to obtain variables from that JS code from WebView.
1 Answer
Yes it's possible by installing Java-JS bridge and then injecting JS into page that collects the data and returns it via JS bridge. See this answer: How to call javascript from Android?
3 Comments
shawndreck
Just want to add that the bridge broken in android 2.3 and you will require a hack for that version
Jim G.
@shawndreck is correct. It's unbelievable that this still isn't fixed. code.google.com/p/android/issues/detail?id=12987
Name is Nilay
@shawndreck - I face this same problem in Android 2.3...can u suggest me that hack u were talking about.