Reputation: 2747
Is it possible to control which JS is executed in an Android WebView on a fine-grained level? As far as I can tell it is only possible to enable/disable JS in the WebView globally and add JS Interfaces.
But what about blocking just certain APIs in a WebView? Is this possible?
Upvotes: 1
Views: 129
Reputation: 6881
This is what you can do:
Prevent certain JS source files from being loaded by overriding WebViewClient.shouldInterceptRequest
.
After loading the page, override the functions / object you want to disable with empty functions / nulls / whatever.
Upvotes: 2