2

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 Answers1

3

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?

Community
  • 1
  • 1
Peter Knego
  • 79,991
  • 11
  • 123
  • 154
  • 1
    Just want to add that the bridge broken in android 2.3 and you will require a hack for that version – shawndreck May 15 '12 at 01:12
  • @shawndreck is correct. It's unbelievable that this still isn't fixed. https://code.google.com/p/android/issues/detail?id=12987 – Jim G. Aug 16 '13 at 13:49
  • @shawndreck - I face this same problem in Android 2.3...can u suggest me that hack u were talking about. – Name is Nilay Jan 06 '14 at 13:28