A domain-whitelisted browser built on Android WebView
androidwebviewparental-controlswhitelistbrowserdns-filtering
For a locked-down kid phone, the browser lives inside the device-owner app: a WebView activity with a tile-grid home and an address bar, exposed as a separate "Browser" launcher alias and forced as the default browser. It allows only parent-approved domains.
Enforcement layers
- Main-frame navigations are checked against the whitelist in both
shouldOverrideUrlLoadingandshouldInterceptRequest; the second one catches server-side redirects the first never sees. - Frames: requests whose
Sec-Fetch-Destisiframeorframeare checked too, so an allowed page cannot embed a blocked site. - Subresources load freely (scripts, images, CDNs); a whitelist on those breaks every site. Content safety comes from family-filter DNS (CleanBrowsing family, set as the device's private DNS) as the backstop.
- Downloads blocked; non-http(s) schemes dropped; SSL errors fail closed.
Whitelist entries carry an include_subdomains flag. Matching must be fail-closed and parse the host properly: userinfo@host tricks, punycode, IP literals and ports were all audited and handled.
Domain choices that were deliberate
Allowed 3D-printing and education sites (Printables, Thingiverse, MakerWorld, Wikipedia, YouTube with Restricted Mode via DNS). Excluded unmoderated aggregators and sites with NSFW sections (Cults3D, MyMiniFactory, Thangs, Yeggi).
Known gaps
- Without a
WebChromeClientimplementingonShowCustomView, YouTube fullscreen does nothing. Worth adding before handing the phone over. - The
Sec-Fetch-Destcheck only sees HTTPS; moot because cleartext is blocked by default (nousesCleartextTraffic), but plainhttp://URLs then show Chromium's rawERR_CLEARTEXT_NOT_PERMITTEDpage instead of a friendly one.