Ads are blocked, but not removed from the space on the website

Hi everyone,

The ads are being blocked, but the frame of the ad is still there. In chrome, it displays the sad face with the comment refusal to connect. Is it possible to remove the ads from the page and reclaim the space the ad would take up?

Thanks everyone

Use a plugin like uBlock Origin to cosmetically block elements.

I thought pi hole would cosmetically block the elements too. Is that not the case?

It can be different for each ad. Pi-hole blocks the ad before it's downloaded, so it doesn't really know about how the ad is displayed in the Website. If the site has space reserved for it, you may just see the blank space. Pi-hole + uBlock generally work very well together.

Maybe you all could make a user-script, etc. that removes the white space.

We only operate at the DNS level, we can't do anything to HTML code or browser rendering. There are a number of great tools that can do that and they have been mentioned already in this thread.

How about redirecting the advert to a 1x1 GIF Image?

It does show a transparent pixel, in a frame designed for a bigger image. And hence the white spaces.

Why are the iframes not being blanked? Some sites are showing error messages in place of the adverts when I think that they should show nothing instead.

Can you give us an example site and a screenshot of the rendered html? (And a debug with the updated debugger script would help. pihole -d.)

The front page of Yotube has one such advert in it. Here's what the debug script states:

pi@raspberrypi:~ $ pihole -d ::: Beginning Pi-hole debug at Fri 3 Mar 05:23:53 UTC 2017! ::: ::: This process collects information from your Pi-hole, and optionally uploads ::: it to a unique and random directory on tricorder.pi-hole.net. ::: ::: NOTE: All log files auto-delete after 48 hours and ONLY the Pi-hole developers ::: can access your data via the given token. We have taken these extra steps to ::: secure your data and will work to further reduce any personal information gathered. ::: ::: Please read and note any issues, and follow any directions advised during this process. ::: ::: Detecting Installed Package Versions: ::: Pi-hole: v2.13 ::: WebUI: v2.5 ::: lighttpd/1.4.35 ::: PHP 5.6.29-0+deb8u1 (cli) (built: Dec 17 2016 06:04:43) ::: Pi-hole branch: master ::: Pi-hole rev: v2.13-0-g6f1ed28 ::: AdminLTE branch: master ::: AdminLTE rev: v2.5-0-g00f4d31 ::: ::: Detecting existence of /etc/pihole/setupVars.conf: ::: File exists, parsing...done and was successfully sourced ::: ::: Detecting installed OS Distribution ::: ::: Checking processor variety ::: IPv6 addresses located on eth0 ::: No gateway detected. ::: IPv4 addresses located on eth0 ::: Pinging default IPv4 gateway: Gateway responded. ::: Pinging Internet via IPv4: Query responded. ::: ::: Daemon Process Information ::: Checking http port for lighttpd listener. ::: Correctly configured. ::: ::: Daemon Process Information ::: Checking domain port for dnsmasq listener. ::: Correctly configured. ::: ::: Processes Check ::: Logging status of lighttpd and dnsmasq... ::: ::: Resolver Functions Check ::: Checking for necessary lighttpd files. ::: ::: Detecting existence of /etc/lighttpd/lighttpd.conf: ::: File exists, parsing...done ::: ::: Detecting existence of /var/log/lighttpd/error.log: ::: File exists, parsing...done ::: ::: ::: Detecting existence of /etc/dnsmasq.conf: ::: File exists, parsing...done ::: ::: Detecting contents of /etc/dnsmasq.d/*: ::: ::: File /etc/dnsmasq.d/01-pihole.conf found ::: Parsing...done ::: ::: File /etc/dnsmasq.d/README found ::: Parsing...done ::: ::: ::: Detecting existence of /etc/pihole/whitelist.txt: ::: File exists, parsing...done ::: ::: Detecting existence of /etc/pihole/blacklist.txt: ::: File exists, parsing...done ::: ::: Detecting existence of /etc/pihole/adlists.list: ::: File exists, parsing...done ::: ::: Analyzing gravity.list ::: ::: Analyzing pihole.log ::: ::: --= User Action Required =-- ::: Try loading a site that you are having trouble with now from a client web browser.. ::: (Press CTRL+C to finish logging.) ::: ::: pihole.log ::: Logging will automatically teminate in 60 seconds ::: Finshed debugging!. ::: The debug log can be uploaded to tricorder.pi-hole.net for sharing with developers only. ::: Would you like to upload the log? [y/N] y ::: ---=== Your debug token is : a5cowpwq0w Please make a note of it. ===--- ::: Contact the Pi-hole team with your token for assistance. ::: Thank you. ::: A local copy of the Debug log can be found at : /var/log/pihole_debug.log

Thanks, it looks like you're using a custom list in your adslist.list. Are you just running the lighttpd server or do you have another webserver installed on the Pi?

I am just running lighttpd.

Short answer is you'll see "page not found" on blocked secure urls, and you'll have to live with it. @jacob.salmela has given the best solution above

You're not seeing a transparent pixel on Youtube is because that frame is requesting https (secure) content. Try going to http://pubads.g.doubleclick.net/ and https://pubads.g.doubleclick.net/. On http lighttpd will serve you pihole, and on the second it's "page not found" because if pi-hole did serve secure content, you'd have "warning this isn't a secure connection, do you want to proceed", "accept this certificate temporarity", etc. You'd have to confirm, click accept for each secure ad, on each browser in your pc. Multiply that with every computer on your network.

You could create your own SSL certificate using OpenSSL, add it to lighttpd (or whichever server), and then add that certificate as a trusted certificate to each of your client PCs. If it were easier, it would be easy for malware to disguise as your HTTPS bank for example, and not have certificate warnings.

2 Likes

Still, a way to be able to hide elements without having to rely on extensions, etc. would be nice. There's already a style sheet that is available but it hasn't been updated in a long time. You can see it by going to Fanboy's Adblock List for Opera. I wonder if there's a way to make a CSS that removes the elements that correspond to the entries in the HOSTS file...

I have discussed before how you can configure Pi-hole to see the URLs instead of just the domains using some lighttpd.conf rules and logic, but It's impractical at this point...

Can you please link to it?

I guess the simple solution would be for someone to be updating the CSS I mentioned to be hiding more adverts.