One feature still missing from WebPositive is an ad-blocker. Although there are a few caveats and it isn’t exactly straight forward, there is a way to avoid ads. It uses a “hosts” file that redirects traffic from known ad-servers.
Get an ad-blocking hosts file, e.g. Steven Black’s. You may want to update that one regularly.
Copy the hosts file to /system/settings/network/.
If WebPositive keeps stalling for long periods, you can intercept the redirected traffic by starting PoorMan (just go with its default settings) before starting WebPositive.
For some reason, some sites don’t like being ad-blocked in this way. Those just never load in WebPositive and leave the page empty. To get them loading, you have to quit WebPositive, rename the hosts file, and restart WebPositive. I can live with that, because I don’t frequent many sites having this problem often.
To make it easier, I created a script “Hosts-are-ON” and put it on the Desktop:
#!/bin/sh
# toggle ad-blocking hosts file
cd /system/settings/network
if [ -e hosts ] ; then
mv hosts hosts_off
mv ~/Desktop/Hosts-are-ON ~/Desktop/Hosts-are-OFF
else
mv hosts_off hosts
mv ~/Desktop/Hosts-are-OFF ~/Desktop/Hosts-are-ON
fi
Now a simple double-click on the script renames the hosts file and by renaming the script itself, shows if ad-blocking is turned on or off.
Definitely only a stop-gap solution until WebPositive learns to ad-block itself, and not suited for everyone, but I thought I post about it anyway.
The way those “filters” work is by saying the IP of the ad servers is your own machine, so the system sends the requests to your machine instead of to the real servers. Now, if your own machine does not have a web server running, those requests get stuck until a time limit to wait for a response is reached.
Interesting. So different behavior than Windows in that regards at least.
If this is case does Haiku wait too long for a response? I would think that is something that could be altered, because it should know if a certain port is open or not (thinking in netstat terms at least).
Maybe the Haiku/Web+ behaviour has changed since I wrote that, but back then the delay without a webserver catching those redirects were quite drastic, IIRC.
I’ve been auto-launching Poorman ever since. I copied the Poorman binary and set its flags to “Background app” with the FileType addon, to avoid it clogging the Deskbar…
I think what changed was Stevenblacks’s host list. They no longer designate a “valid” adress like 127.0.0.1 but now use 0.0.0.0, which is unrouteable and should fail immidiently. This is all Afaik anyhow.
Thank you for the tip about poorman, I’ll keep that it mind.
I’m using hblock, but I modified the number of sites that it makes it’s list from, as I found it seemed to bog down WebPositive. StevenBlacks was one of the one’s that I cut. I’ll have to try adding it again, and see what it does.
Edit:
As an added side bonus, on a fresh install of a development build, using hblock stopped WebPositve from crashing while trying to view the NFL scoreboard on nbcsports.com. I’ve had problems with WebPositve crashing when viewing some sites, so this helps a lot.
Sorry I did not get it.
What to to with the link? Copy it and save it as…?
Which archive where to get it?
If I open the link there is nothing to download or clone?
Sorry this is not easy to follow for me
Edit:
I installed hblock from HaikuDepot. In terminal I started “hblock”… It generated the block-list file “hosts” as mime-text file in boot/system/settings/network/
This means I can just copy and paste the StevenBlack’s list into a text-file and overwrite the automatic generated file by hblock “hosts” in boot/system/settings/network/
The URL used to point to a zip archive, now it’s a link to the hosts file itself. I’ve updated the text and also made item 3, the starting of Poorman, optional.
Yes, it is that simple. You want to keep the header (eg this section) however, as it is required for the system to work correctly, so just put your customization after this section.
You probably should just copy the entries from the StevensBlacks list after the
Nice, it easy if you know what to do.
But one question I still have: Should I keep the automatic hblock entries too or should I keep only the one from StevenBlack?
Thanks all, very helpfull and nice to learn. Web+ feels faster now?! Is it?
Offtopic, but how do I send a PM to a user? I discovered Haiku a few weeks ago, and wanted to start translating. I connected my Github to i18n.kacperkasper.pl and need a mod to auth me. This interface is very confusing for me, can’t find the right buttons.
I am unable to download the file at https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
I right click on the link in this thread and select “Download Linked File” I then waited almost 2 hours and I have 0% downloaded. I have tried several times. Does anyone have this?
Alternatively you can just click on the link select all the text and copy and paste it to a new text file in Haiku.
right click on desktop =>new=>text file
and save this textfile as hosts.
Paste this textfile (hosts) to: boot/system/settings/network/
If there is already a hosts file you can add/apply/append the text you just copied to it. Read the above articles from extrowerk for how to do this.