Android Question Inject Javascript in webview

Mansour01

Member
Licensed User
Longtime User
Hi
since yesterday i tried to understand how to inject some javascript (*.js) into a loaded url , but i can't figure it out how to do that , something that works like Greasemonkey .
can anyone do me a favor & make a small but functional example ?!
Just something like :

alert('Hello, World!');

Thank You
 

Mansour01

Member
Licensed User
Longtime User
I did , but i can't really figure it out how it works !
I almost read all of thread about Webextra .
that's why i need a functional example ,
Thank You
 
Upvote 0

Mansour01

Member
Licensed User
Longtime User
Do you want to directly inject javascript such as:

B4X:
MyWebView.LoadUrl("javascript:alert('Hello World')")

Or do you want to dynamically create a new <script> tag in the webpage that will load an external .js javascript file?
This second option is a bit more complicated, take a look at these search results: https://www.google.co.uk/search?q=javascript add script tag&ie=UTF-8&oe=UTF-8.

Martin.
Thank you Martin ,
the problem was my script's structure , at last i did the job .
Tanx
 
Upvote 0
Top