webOS Nation Forums >  webOS apps and software >  webOS development > How about an ad blocker
How about an ad blocker

  Reply
 
LinkBack Thread Tools Display Modes
Old 07/07/2009, 06:44 PM   #1 (permalink)
Member
 
Join Date: Jun 2009
Posts: 130
Likes Received: 1
Thanks: 23
Thanked 9 Times in 6 Posts
Default How about an ad blocker

I am not a developer, yet I think something the Pre really needs is a good ad blocker for the browser. Right now, the browser loads most of a web page's content content immediately, then sits and loads the ads for the site. This normally wouldn't be an issue, but double tapping to auto-zoom in does not stick until a web site is completely loaded.

So, how feasible would it be to make an ad blocker for the web browser? Initially it could just be a quick hack, but ultimately it would be best if such a program would have the ability to auto-download its own filters. Thoughts?
roninj is offline   Reply With Quote
Old 07/07/2009, 07:33 PM   #2 (permalink)
Member
 
Join Date: Sep 2003
Posts: 418
Likes Received: 38
Thanks: 19
Thanked 35 Times in 26 Posts
Default

Could easily do this on a rooted Pre by updating the hosts file. Should be dozens, if not hundreds, of lists out there.
jsabo is offline   Reply With Quote
Old 07/07/2009, 07:40 PM   #3 (permalink)
Member
 
Join Date: Jun 2009
Posts: 130
Likes Received: 1
Thanks: 23
Thanked 9 Times in 6 Posts
Default

Thanks. That's another reason to root. Once the warranty issue has been further clarified, and the pricess has become a little more mainstfeamed, I'll take the plunge.
roninj is offline   Reply With Quote
Old 07/07/2009, 08:35 PM   #4 (permalink)
Member
 
Join Date: Jun 2009
Posts: 297
Likes Received: 0
Thanks: 5
Thanked 19 Times in 19 Posts
Default

Jasbo, esplain preez?
EDIT: Stupid nonintentional pre puns.
The_lane is offline   Reply With Quote
Old 07/07/2009, 11:51 PM   #5 (permalink)
Member
 
Join Date: Sep 2003
Posts: 418
Likes Received: 38
Thanks: 19
Thanked 35 Times in 26 Posts
Default

When you go to a web site, you enter the domain name-- www.google.com. That resolves to an IP address like 128.33.12.129.

That's currently done using using DNS-- domain name service. Your internet-capable device talks to a DNS server and says "hey, where is www.google.com at?" If your DNS server knows the answer, it will send it back to you. If not, it will check at a higher level to see who *does* know the answer, and go get it.

DNS didn't exist when the internet first got started-- there were so few machines that it was possible to manually track them all. This was done with what's know as a host file-- instead of going to a DNS server to see where www.google.com is at, you would check that file to get the IP address.

The upshot of all this is that all tcp-IP based devices still use that host file as their first lookup point for addresses.

There are a variety of reasons why you might do this, but ad blocking is the most common-- I can say "ads.doubleclick.com" is really the same IP address as Google, so when it tries to get an ad, the program isn't there, and the ad never appears.

On windows, the file is in c:\windows\system32\drivers\etc\hosts. Not sure where it is on the Pre, but it should be relatively easy to find & update.

The hosts files I was seeing online were huge-- around 1.5MB-- which might be a lot for the Pre. What I would do is hit your favorite web pages with a real PC, see where the ads are coming from, then block just those sites.
jsabo is offline   Reply With Quote
Thanked By: redbirdie
Old 07/08/2009, 03:27 AM   #6 (permalink)
Member
 
Join Date: Jun 2009
Posts: 297
Likes Received: 0
Thanks: 5
Thanked 19 Times in 19 Posts
Default

Well, I know where I'm starting for my first app. Thanks for all the detail, I basically understood what I was changing, now I KNOW.
The_lane is offline   Reply With Quote
Old 07/08/2009, 04:17 AM   #7 (permalink)
Homebrew Developer
 
enormous's Avatar
 
Join Date: Dec 2007
Location: D.C. Area
Posts: 195
Likes Received: 0
Thanks: 73
Thanked 39 Times in 20 Posts
Default

Since the Pre runs Linux the hosts file will be at /etc/hosts.
enormous is offline   Reply With Quote
Old 07/08/2009, 05:32 AM   #8 (permalink)
Member
 
Join Date: Jun 2009
Posts: 360
Likes Received: 0
Thanks: 10
Thanked 66 Times in 35 Posts
Default

Another way to go would be to sent up a proxy on the phone and forward port 80 through it using iptables kinda like this:
Transparent Proxy as Adblock using Tinyproxy and Dansguardian « BroddlIT

A hosts file manager app would be neat too.
joshewah is offline   Reply With Quote
Old 07/08/2009, 06:16 AM   #9 (permalink)
Member
 
Join Date: May 2009
Posts: 275
Likes Received: 2
Thanks: 5
Thanked 101 Times in 31 Posts
Default

^ Doesnt that run in the background though?? Would be better if it were browser-based.
peestandingup is offline   Reply With Quote
Old 07/08/2009, 10:28 AM   #10 (permalink)
Member
 
Join Date: Oct 2007
Posts: 534
Likes Received: 0
Thanks: 18
Thanked 16 Times in 11 Posts
Default

Here's a hosts file i found that seems pretty extensive. I'm testing it and it doesn't seem to slow things down at all.
http://phwelo.mobi/hosts
heres an ipk to make it easier for some:
http://phwelo.mobi/ipks/hosts.ipk
__________________
http://phwelo.mobi
for any questions or to send a donation: phwelo@gmail.com
phwelo is offline   Reply With Quote
Old 07/29/2009, 04:06 PM   #11 (permalink)
Homebrew Developer
 
enormous's Avatar
 
Join Date: Dec 2007
Location: D.C. Area
Posts: 195
Likes Received: 0
Thanks: 73
Thanked 39 Times in 20 Posts
Default

I used the one from:
Blocking Unwanted Parasites with a Hosts File

and it's working well. One point though: if ^M characters at the end of the line bug you (they bug me!), then you can remove them with:

Code:
cat file1 | sed s/.$//g >> file2
This is a workaround since it appears that the Linux flavor running on the Pre doesn't let you enter <Ctrl-V><Ctrl-M> to produce the ^M. I also received a segfault when trying to read in the new file (:r) in vi.

Also don't forget to append your new hosts file to your old one (>>) and remove the duplicate "127.0.0.1 localhost" line from the appended file.
enormous is offline   Reply With Quote
Reply

 

Thread Tools
Display Modes



 


Content Relevant URLs by vBSEO 3.6.0