is there some library for android for block any ads? how to block using javascript injection?
When I code
webView1.getSettings().setJavaScriptEnabled(true);
the ads are shown, but other option of the page not working as the menu or filters. then how can I block ads but not disable javascript?
For reference, the AdBlock plus Github page offers an AdblockWebView. To use it, you add this line to your Gradle file:
implementation 'org.adblockplus:adblock-android-webview:3.14'
And then add this to your layout's XML file:
<org.adblockplus.libadblockplus.android.webview.AdblockWebView
android:id="@+id/main_webview"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
It works just like a regular WebView component.
You can use this official library:
https://github.com/adblockplus/libadblockplus-android
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