How to access html elements contained within a web view?

I am creating a text editor in android for my project. I used the TinyMCE open source project, made some adjustments and integrated it into my WebView ...

There is one submit button in the HTML file that I uploaded to WebView ...

I want to know how to record his onClick event so that I can write Java code to save the data that has been entered so far in the editor on the SD card, whenever the submit button is pressed ..

thanks

+6
source share
2 answers

You cannot directly access the DOM with Java (as far as I know), but you can use JS to call Java functions with variables and transfer data when using this. You can learn more about how to bind Java to JS in Android (with a sample) from docs .

+5
source

Unfortunately, there is no API implementation for accessing any of the HTML in WebView.

0
source

Source: https://habr.com/ru/post/916946/


All Articles