Skip to content Skip to sidebar Skip to footer

Android: Injecting Javascript Into A Webview Outside The Onpagefinished Event

Hey experts, actually it's a pretty simple question...just don't know about the answer. I have an Android app, running a WebView that loads a certain page, also part of the app. At

Solution 1:

Is that possible?

Sure. Use loadUrl("javascript:...");, where the ... is whatever Javascript you wish to run in the context of the currently-loaded Web page. It's basically the same trick that bookmarklets use.

Here is a sample project demonstrating this, by pushing a GPS location over to Javascript.

Post a Comment for "Android: Injecting Javascript Into A Webview Outside The Onpagefinished Event"