I am making a custom simple web browser for Android and needed to capture the content of every page the user browses and manipulate it before rendering so that it displays as expected.
I don't want to break user login state and interaction, so I don't want to intercept the POST request or cookies.
So far as I know, I can put the content with loadDataWithBaseURL()
.
However, to make a better user experience, I wan to get the content and manipulate before the user sees it, and if possible, before images being downloaded (like DOMReady
in JS), but had no clue how to do it.
What is the best place to listen to, and how can I get the current webview
content?
Since I am new to Android development, I was looking for a good advice for the solution. Thanks.
you can use shouldInterceptRequest
method. there is an example:
webview shouldinterceptrequest example
Hope this is useful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With