Ad blocking in SailfishOS in 2023 - What are the options?

Ok, @eson, try this mouthful of command at the end of the script

notificationtool -o add -a "restart;Restart org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager RestartUnit booster-browser@sailfish-browser.service replace" "Adblock Hosts updated" "Click Restart to restart browser." -A hosts-block -I icon-l-calendar-cancelled

This does not restart the browser, but shows a notification that kills it if you so wish, you restart it yourself.

2 Likes

Thanks, but I do not wish to use that script at all. Iā€™m very happy with my simple solution.
However, I did a quick test on the @martinh command ( pkill -f browser), and it actually works to apply the updated hosts file without reboot.

Simplest native AdBlock solution, since we only see ads in the browser (works for me on C2):
Edit DoH settings in about:config.

  1. Enter about:config in address bar, swipe to accept
  2. Scroll all the way down to network.trr.default_provider_uri
  3. Replace the cloudflare DNS url with one from this list https://github.com/curl/curl/wiki/DNS-over-HTTPS
  4. Scroll further down to network.trr.mode
  5. Set it to 3 (always use DoH)
  6. Tap accept

Then test at some AdBlock Test Site If it works.

6 Likes

Unfortunately ads will also be shown in Android Apps. Therefore I use the firewall to redirect remote traffic to port 53 to an ad-blocking DNS.

1 Like