View Full Version : Ad blocking
coffeedrinker
01-09-2008, 03:26 PM
I've posted this before but since some people are having trouble with the Adblock plugin for microb, I thought I'd repost this:
Ad blocking with css:
http://floppymoose.com has a good file (doesn't get everything though).
Save the file userContent.css to /home/user/.mozilla/microb/chrome/userContent.css to enable blocking with that file.
Restart browser once you have the file in place. Make sure permissions and ownership are set right.
This solution is very fast and very easy to setup.
bexley
01-09-2008, 03:41 PM
Thanks. I'll give it a go.
So, Adblock still has troubles, eh? My main question is whether there's still no fix for the supposed sluggishness it causes in Microb. Other issues I can deal with, but Microb is slow enough as it is.
I'm guessing there's lots of scripts for Greasemonkey for ad-removal. Has anyone found some that work well with Microb?
Lastly, to shove all of my ad-blocking questions into one post, is there a way to disable Adblock without uninstalling it?
Thanks. I'll give it a go.
So, Adblock still has troubles, eh? My main question is whether there's still no fix for the supposed sluggishness it causes in Microb. Other issues I can deal with, but Microb is slow enough as it is.
I'm guessing there's lots of scripts for Greasemonkey for ad-removal. Has anyone found some that work well with Microb?
Lastly, to shove all of my ad-blocking questions into one post, is there a way to disable Adblock without uninstalling it?
It's not that hard to experiment with it, instead of relying on what other people say. Yes, you can disable it, which is handy because it causes some sites not to load at all, on my system. When it works, I don't notice any slowness penalty. In fact, it speeds things up significantly on many sites because you don't have to wait for innumerable ads to download. Give it a try.
Make sure permissions and ownership are set right.I could use a little elaboration on that if you don't mind. Thanks.
coffeedrinker
01-09-2008, 07:00 PM
Um, just make sure you can read from the directory and file as your normal user. :)
bexley
01-09-2008, 07:10 PM
It's not that hard to experiment with it, instead of relying on what other people say.
Experiment with what? It's pretty clear that I couldn't find out how to disable it. It's not listed as a Microb component or in the settings. I've got Adblock Plus installed.
> Yes, you can disable it.
Thanks for telling me how. You chastise me for asking a question and then half-answer it.
Anyway. I'm going to try the CSS script and privoxy.
My (partial) solution is modifying the /etc/hosts to point the ads sites to nowhere. This method takes care of the majority of the ads and has least impact on system performance.
Root privilege is required to modify the /etc/hosts.
munky261
01-10-2008, 02:47 AM
adblock does speed up surfing , when you already have a window open , but the 10-15 sec delay when opening a new browser window from the desktop is unacceptable.
Rebski
01-10-2008, 06:01 AM
My (partial) solution is modifying the /etc/hosts to point the ads sites to nowhere.
I would like to do that but have no idea what it entails. Would you post a how-to, please?
open xterm
cd /etc
sudo gainroot
wget http://www.mvps.org/winhelp2002/hosts.txt
mv hosts hosts-orig
cat hosts-orig hosts.txt > hosts
rm hosts.txt
Mvps is one out of 10 major lists existing.
http://pgl.yoyo.org/adservers/
http://www.hosts-file.net/
http://someonewhocares.org/hosts/
http://hostsfile.mine.nu/
If you have a local http server running then you should change 127.0.0.1 to something else or rely on another method.
I've tried various ad blocking techniques over the short time I've had my N800 - GreaseMonkey (+Scripts), Adblock+, fakeweb with modified hosts file and currently the custom userContent.css file.
The userContent.css file blocks quite a lot of ads, although not as many as the large hosts file and fakeweb, and was was wondering about the performance hit from having a large hosts file compared to the relatively small userContent.css script.
If you have a local http server running then you should change 127.0.0.1 to something else or rely on another method.
e.g. 0.0.0.0
Thanks for the nice write-up.
Experiment with what? It's pretty clear that I couldn't find out how to disable it. It's not listed as a Microb component or in the settings. I've got Adblock Plus installed.
> Yes, you can disable it.
Thanks for telling me how. You chastise me for asking a question and then half-answer it.
Anyway. I'm going to try the CSS script and privoxy.I did not chastise you. I didn't say anything personal at all, not did I mean to imply anything negative.
From the browser menu go to 'tools' -> 'components' : uncheck / check adblock plus
GeneralAntilles
01-12-2008, 11:47 PM
The userContent.css file blocks quite a lot of ads, although not as many as the large hosts file and fakeweb, and was was wondering about the performance hit from having a large hosts file compared to the relatively small userContent.css script.
The idea is to use both. The big gain with the hosts over almost every other method (minus privoxy), is that it prevents the ads from even being loaded. This saves time, bandwidth, CPU and RAM.
But no, there is no hit with a large hosts. Instead of resolving the URL from a DNS server, it resolves from the hosts, which points nowhere.
The idea is to use both. The big gain with the hosts over almost every other method (minus privoxy), is that it prevents the ads from even being loaded. This saves time, bandwidth, CPU and RAM.
But no, there is no hit with a large hosts. Instead of resolving the URL from a DNS server, it resolves from the hosts, which points nowhere.
So the userContent.css is post filtering the data being displayed after it's downloaded - similar to what some GreasMonkey scripts do? I was thinking it was also reducing the downloaded data... I need to do some tests.
Also, if I have a 50K host file doesn't the browser have to check every link address with the list before sending it out to the internet DNS? I was thinking about the time taken to perform this check.
GeneralAntilles
01-14-2008, 05:17 PM
So the userContent.css is post filtering the data being displayed after it's downloaded - similar to what some GreasMonkey scripts do?
The elements are still downloaded, they're just not displayed.
Also, if I have a 50K host file doesn't the browser have to check every link address with the list before sending it out to the internet DNS? I was thinking about the time taken to perform this check.
I'm fairly certain it just loads the info into whatever does the DNS looksup (as I believe a restart of the browser is required for changes to stick), so it's not an issue of polling the hosts file (which is a stupidly trivial thing to do anyway) and the impact is nil.
Either way, avoiding loading advertisements would most certainly make up for any slight performance hit of a large hosts file if there actually were one. :rolleyes:
coffeedrinker
01-14-2008, 05:57 PM
Make sure you do not mess up your original hosts file. See my post:
http://internettablettalk.com/forums/showpost.php?p=109379&postcount=5
Make sure you do not mess up your original hosts file. See my post:
http://internettablettalk.com/forums/showpost.php?p=109379&postcount=5
Exactly,
That's why in the few lines, I *append* the ad-blocking host to the current original one.
ghoonk
01-15-2008, 06:41 AM
Linux newbie here. How do I append the ad-blocking host to the original one?
Linux newbie here. How do I append the ad-blocking host to the original one?
You need to install becomeroot or easyroot to allow root access (search www.gronmayer.com/it (http://www.gronmayer.com/it) to find it) to modify the /etc/hosts file. You will also need to install wget if you want to follow the process outlined in post #10 above (copied here):
cd /etc
sudo gainroot
wget http://www.mvps.org/winhelp2002/hosts.txt
mv hosts hosts-orig
cat hosts-orig hosts.txt > hosts
rm hosts.txt
This assumes your downloading the hosts file from the web directly onto your N8x0. I downloaded the host file via the web browser (which removes the need to install wget) and saved it to the internal SD card, so my equivalent was (assuming the downloaded file was hosts.txt):
sudo gainroot
cd /etc
mv hosts hosts-orig
cat hosts-orig /media/mmc2/hosts.txt > hosts
The 'mv hosts hosts-orig' line backs up your original file and can be recovered using 'mv hosts-orig hosts' when your in the /etc directory with root access.
I hope this clarified things. I can't stress how much of an improvement running one of these host file additions makes to the quality of web browsing ( unless you like seeing all the ads :p ).
ghoonk
01-15-2008, 07:29 AM
Is there any way I can copy the existing hosts file out of the N800, edit it on my PC (WinXP) and then copy it back into the N800?
my commandline skillz is teh fail (i can lolcattalk too), and with things working all fine and dandy on my tablet now, I would REALLY hate to screw it up.
GeneralAntilles
01-15-2008, 07:33 AM
Is there any way I can copy the existing hosts file out of the N800, edit it on my PC (WinXP) and then copy it back into the N800?
The steps outlined on the last page are hardly advanced stuff. Just do exactly as it says and everything will work fine.
Is there any way I can copy the existing hosts file out of the N800, edit it on my PC (WinXP) and then copy it back into the N800?
You can, using 'mv hosts /media/mmc2/hosts' (at which point the file can be seen via USB on the PC), but be aware that PC files can have different end of line terminators than linux files... so I'd recommend doing it on your N800 directly.
You are not actually editing the host file, all you are doing is making a new host file by joining the current host file (which has your machine ID) and the ad blocking list to create the new super host file.
ghoonk
01-15-2008, 07:53 AM
That worked. Application Manager works fine too.
Now to test it over the next couple of days to see what kind of improvement I can get. I've turned off AB+ just to get an idea of how this works.
Thanks, guys!
coffeedrinker
01-15-2008, 12:51 PM
Exactly,
That's why in the few lines, I *append* the ad-blocking host to the current original one.
What got me into trouble was using the same hosts file after an OS update. The localhost line changes with each update.
Redshift
03-19-2008, 08:27 PM
Thank you for the very clear instructions! I have modified my hosts file using the one from hosts-file.net following the posted instructions. Now however instead of ads I'm seeing the CSS placeholders and messages telling me server could not be found. I think I'm also supposed to use UserContent.css or Greasemonkey scripts to hide those now defunct css elements right? Is there a preference for which one?
Edit: Did some googling and yeah, I figured it out. However, http://www.floppymoose.com isn't working for me. Anyhow, I found a website that suggests that using Mozilla's built in image blocking may be more effective than using CSS filtering.
http://www.gozer.org/mozilla/ad_blocking/
Anyone use this?
n9mjg
03-20-2008, 08:56 AM
Frankly, it think privoxy is easier to use and does a more thorough job of ad blocking. Just install the deb and point set the proxy settings and your done.
traveller604
03-20-2008, 09:11 AM
Is there by the way some faster way to switch proxies? Most of the time I'm behind privoxy, but every now and then I need to be in my uni's "ip space" and frankly it's a ***** to change those settings.. so many clicks..
iamthewalrus
03-20-2008, 04:04 PM
Is there by the way some faster way to switch proxies? Most of the time I'm behind privoxy, but every now and then I need to be in my uni's "ip space" and frankly it's a ***** to change those settings.. so many clicks..
Create a new connection that doesn't have the proxy settings set, and then switch when necessary.
brontide
03-20-2008, 05:24 PM
I did a
mv /etc/hosts /etc/hosts.orig and then created the following script.
#!/bin/sh
cp /etc/hosts /etc/hosts.bak
wget -q -O - http://www.mvps.org/winhelp2002/hosts.txt | sed -e 's|127\.0\.0\.1 localhost|127\.0\.0\.1 Nokia-N810-50-2 localhost|' > /etc/hosts
Note the one item will need to be changed based on your original hosts file. I love CPU non-intensive adblocking tricks. I also run my own .css rules for the sites I visit.
iamthewalrus
03-28-2008, 10:56 AM
Is there a way to log/monitor which HTTP requests are directed to 127.0.0.1 because of the the hosts file, (short of installing apache)? Since I added this here (http://everythingisnt.com/hosts) to my hosts file I can't open youtube movies, either from Microb or the MyTube app. So I experimented a bit with tcpdump, but I haven't been able to see the complete http request. Probably probably because HTTP is one level up on the network stack.
I use privoxy and I'm more than happy with it.
iamthewalrus
03-28-2008, 04:53 PM
I use privoxy and I'm more than happy with it.
I used privoxy as well but it seems to eat up half the bandwidth, while the hosts/userContent.css method does not.
coffeedrinker
03-28-2008, 08:23 PM
You really have to be careful which adblock host file you use. I use the one from floppymoose because some I've used in the past blocked a lot more than just ads. If the one you are using isn't suitable, try a different host file.
iamthewalrus
03-28-2008, 09:10 PM
You really have to be careful which adblock host file you use. I use the one from floppymoose because some I've used in the past blocked a lot more than just ads. If the one you are using isn't suitable, try a different host file.
Floppymoose only has an example userContent.css file, not a hosts file. Still I would prefer to test and tweak the hosts file myself, so my question remains how to log what has been blocked by it.
coffeedrinker
03-28-2008, 11:31 PM
Heh, yep, I got that wrong. I'm way over tired.
I use the same file you listed above:
http://everythingisnt.com/hosts.html
but I don't have seem to have trouble with it.
Redshift
03-29-2008, 04:31 AM
I feel really stupid for asking this question, but I tried saving the userContent.css file to a few places and then found it via xterm. However, it won't let me do the command "mv userContent.css /home/user/.microb/chrome". It gives me the error:
"mv: cannot rename 'userContent.css': No such file or directory." What's going on?
iamthewalrus
03-29-2008, 04:53 AM
I feel really stupid for asking this question, but I tried saving the userContent.css file to a few places and then found it via xterm. However, it won't let me do the command "mv userContent.css /home/user/.microb/chrome". It gives me the error:
"mv: cannot rename 'userContent.css': No such file or directory." What's going on?
Like the error message said there is no directory '/home/user/.microb/chrome'. You need to create the 'chrome' directory first. B.t.w. another gotcha is to make sure that userContent.css contains unix-style line endings , and it is readable by user 'user'.
Redshift
03-29-2008, 05:10 AM
Well, I had made the chrome directory before trying to move it. I also tried moving it to /, /home, those didn't work either, so I knew it wasn't something wrong with the target directory being invalid...
iamthewalrus
03-29-2008, 05:18 AM
Well, I had made the chrome directory before trying to move it. I also tried moving it to /, /home, those didn't work either, so I knew it wasn't something wrong with the target directory being invalid...
You forgot to put the filename at the end of the command:
mv userContent.css /home/user/.microb/chrome/userContent.css
Redshift
03-29-2008, 05:31 AM
I'd tried that prior to posting, and yeah that still doesn't work. I even tried gaining root access. I really don't want to have to plug my Nokia into my desktop all the time just to move some files around.
GeneralAntilles
03-29-2008, 07:18 AM
I'd tried that prior to posting, and yeah that still doesn't work. I even tried gaining root access. I really don't want to have to plug my Nokia into my desktop all the time just to move some files around.
You're obviously still doing it incorrectly.
Besides, you can't access the rootfs via USB.
Redshift
03-29-2008, 01:19 PM
Not sure what happened, but I created a test subdirectory and moved it there, and then was able to move it to "/". Then I realized I had the target path wrong, it's /home/user/.mozilla/microb/chrome, although I'm still pretty sure it wasn't letting me move it to "/" or "/home" last night.
qwerty12
04-07-2008, 05:26 AM
Who finds that using a hosts file slows down the N800?
I'm using OS2008 51 and first time, I used a massive host list and the speed was unbearable.
Now, I'm using a 40 KB host file that I removed duplicates & changed ip to 0.0.0.0 and the speed has gone down of the whole N800.
brontide
04-07-2008, 09:39 AM
Who finds that using a hosts file slows down the N800?
I'm using OS2008 51 and first time, I used a massive host list and the speed was unbearable.
Now, I'm using a 40 KB host file that I removed duplicates & changed ip to 0.0.0.0 and the speed has gone down of the whole N800.
Hmmm... the dnsmasq daemon is only configured to cache 150 enteries, I wonder what would happen if you expanded that to be wc-l hosts + 150?
prk60091
04-07-2008, 02:40 PM
Who finds that using a hosts file slows down the N800?
I'm using OS2008 51 and first time, I used a massive host list and the speed was unbearable.
Now, I'm using a 40 KB host file that I removed duplicates & changed ip to 0.0.0.0 and the speed has gone down of the whole N800.
did you try using 127.0.0.1? i have a fairly large host file on my 810 and i find it quite speedy
danguyf
04-08-2008, 05:46 AM
I have a big hosts file and have seen no apparent slow-down resulting.
qwerty12
04-08-2008, 05:50 AM
did you try using 127.0.0.1? i have a fairly large host file on my 810 and i find it quite speedy
I haven't come think of it. I thought 0.0.0.0 was supposed to be speedier but I'll try it out, thanks!
brontide
04-08-2008, 08:51 AM
I haven't come think of it. I thought 0.0.0.0 was supposed to be speedier but I'll try it out, thanks!
127.0.0.x, 0.0.0.0... try pinging them, they all get answered by 127.0.0.1
So I think the only real change would be the flush of all the buffers when you switched. Also has anyone tried using /etc/dnsmasq.conf rather than updating the hosts file directly?
# or if you want it to read another file, as well as /etc/hosts, use
# this.
addn-hosts=/etc/banner_ad_hosts
and I use this to populate the file
#!/bin/sh
wget -q -O - http://www.mvps.org/winhelp2002/hosts.txt | sed -e '/127\.0\.0\.1 localhost/ D' > /etc/banner_ad_hosts
All I do with the sed is yank the localhost line since it's not necessary.
If you make changes to dnsmasq.conf you need to restart the daemon '/etc/init.d/dnsmasq restart'
qwerty12
04-08-2008, 09:12 AM
Nice info brontide :)
I plan on shifting my host file.
brontide
04-08-2008, 09:18 AM
Right now I'm also playing with the ttl setting to see if that makes any difference. I can't tell yet, but in theory it should prevent some roundtrips between glibc and dnsmasq, but I'm not 100% positive.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.