Skip to content

Block inline ads via JS injection in WebView - #90

Open
GeoYWang wants to merge 10 commits into
woheller69:masterfrom
GeoYWang:master
Open

GeoYWang wants to merge 10 commits into
woheller69:masterfrom
GeoYWang:master

Conversation

@GeoYWang

@GeoYWang GeoYWang commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

Hello,

This commit injects a small JavaScript snippet via evaluateJavascript()
in onPageFinished(), targeting the ad container by its CSS selector with
a secondary check for the text "Sponsored" to prevent false positives.
A MutationObserver ensures ads injected after page load are also removed
(necessary since chatgpt.com is a SPA).

Tested on Android with a reproducible prompt that reliably triggers the
Preply physics ad. Ad was successfully removed with no visible side effects.

@woheller69

Copy link
Copy Markdown
Owner

not sure if I want to get into this topic. They can change the CSS selector at any time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants