How do I block ads on startpage.com?

8

1

I tried the following, it has no effect:

startpage.com##[style*="background-color:#F5F9FF;"]

Any idea how to solve this?

To reproduce: Go to https://startpage.com/do/search - search for example for adblock. You'll see nasty light blue boxes at the top and bottom of the page reading "Ads related to adblock":

enter image description here

This is with Iceweasel (Firefox 38.2.1) and Adblock Edge 2.1.9.1.


If it's not possible, which secure/privacy-respecting and ad-free sites do you recommend as alternative to IxQuick and Startpage?

0__

Posted 2015-09-29T08:56:43.613

Reputation: 523

If you don't mind using greasemonkey see my answer below. – DavidPostill – 2015-09-29T09:14:15.300

I couldn't find the ads displayed in Chrome with Adblock installed. Even if I disable Adblock extension I could see the text that were being displayed in your screenshot. :/ So, my guess is that one of the extensions that you are using in injecting the ads in that page. Could you disable all the extensions, restart your browser and check again. – Lucky – 2015-09-29T09:16:44.030

2I honestly don't see the problem with Google; all websites track you anyway (whether you like it or not, that's how the Internet works), and there's hardly any advertising (apart from Sponsored Links, which you simply ignore). – AStopher – 2015-09-29T13:35:39.610

Answers

6

Any idea how to solve this?

The ads in question are in a div with ID "spon_links".

<div id="spon_links">

You can use a Greasemonkey script to remove these divs.


Solution 1

This is confirmed as working in Firefox when using the uBlock Origin ad blocker.

// ==UserScript==
// @name        startpage.com remove ads
// @namespace   startpage.com
// @description Removes ads from startpage.com before they are displayed.
// @include     https://startpage.com/*
// @include     https://*.startpage.com/*
// @run-at      document-start
// @version     2015-09-29
// @grant       GM_addStyle
// ==/UserScript==

GM_addStyle("div#spon_links { display: none !important}");

Solution 2

Not tested.

Replace 'ads' with 'spon_links' in the example script below.

4.9. Removing an element

You can use Greasemonkey to remove entire chunks of a page in one fell swoop, with the removeChild function.

Example: Remove an ad sidebar

This presumes that there is an element whose ID is "ads".

var adSidebar = document.getElementById('ads');
if (adSidebar) {
    adSidebar.parentNode.removeChild(adSidebar);
}

Removing an element with removeChild will also remove all the content inside it. For example, if you remove a <table> element, this will also remove all of its table cells (<td> elements).

Source 4.9. Removing an element

DavidPostill

Posted 2015-09-29T08:56:43.613

Reputation: 118 938

Thanks. Apparently it's either a bug in Adblock Edge or some counter action taken by the site. Because I just noticed that the ads are outside the div.spon_links when Adblock Edge is enabled. It does have a filter rule for spon_links. Perhaps there is some JS that moves the ol elements somewhere else when the spon_links is filtered. – 0__ – 2015-09-29T09:18:54.083

2

Following @DavidPostill's notice, I looked again at the page structure. It appears that the text ads are moved outside the div.spon_links when Adblock Edge is enabled which indeed has a filtering rule for spon_links. Whether this is a misbehaviour of Adblock Edge or some counter-action from Startpage I don't know.

There is a simpler solution than adding a custom Greasemonkey script—simply swapping Adblock Edge for uBlock also solved the problem.


On further investigation, the ads only disappear with uBlock enabled when Adblock Edge is entirely disabled at the same time ("Disable everywhere"). Even if I disable it only for Startpage ("Disable on startpage.com"), the site moves the ads outside the spon_links container. My explanation is that Startpage somehow manages to access my Add-ons preferences and checks if Adblock is generally enabled. Could it be that nasty?!


Using David's approach of Greasemonkey and removeChild, I came up with the following solution that still works when Adblock Edge is installed. It seems one has to wait till the page has loaded and toyed around with avoiding ad-block, until you can finally locate and delete the offending elements:

// ==UserScript==
// @name        startpage/ixquick remove ads
// @namespace   startpage.com
// @description Removes ads from startpage/ixquick before they are displayed.
// @include     https://startpage.com/*
// @include     https://*.startpage.com/*
// @include     https://ixquick.com/*
// @include     https://*.ixquick.com/*
// @run-at      document-end
// @grant       none
// @version     2015-09-29
// ==/UserScript==

var fun = function() {
  var results = document.getElementById('bottom-result-container');
  if (results) {
    var ols = results.getElementsByTagName('ol');
    for (i = 0; i < ols.length; i++) {
      var ol = ols[i];
      var ps = ol.getElementsByTagName('p');
      for (j = 0; j < ps.length; j++) {
        var p = ps[j];
        if (p.className == 'head2') {
          var spans = p.getElementsByTagName('span');
          for (k = 0; k < spans.length; k++) {
            if (spans[k].innerHTML.contains("Ads related to")) {
              ol.innerHTML = '';
            }
          }
        }
      }
    }
  }
};
setTimeout(fun, 1);

(Sorry, my JavaScript is a bit rusty, probably easier with jQuery.)

0__

Posted 2015-09-29T08:56:43.613

Reputation: 523

I'm using uBlock Origin as well, and saw the ads. This script fixes it. GM_addStyle("div#spon_links { display: none !important}"); – DavidPostill – 2015-09-29T09:26:36.187

Yes, it is that nasty. There is some JS there which is definitely checking for the existence of some (Chrome?) extensions, and that appears to be where it is detecting adblock. – Kevin Brown – 2015-09-29T15:07:52.047

0

Change your ad blocking extension to uBlock Origin. The page appears normally and without ads in uBlock Origin with either Firefox 41.0 or Chrome 44.0.2403.155 m.

screenshot of startpage.com search results page in Firefox 41 with uBlock Origin

Enable the filters from 'Fanboy+Easylist-Merged Ultimate List‎' (already contains EasyList, EasyPrivacy, Fanboy's Enhanced Tracking, Annoyance and Social Blocking Lists‎ - so there's no need to also enable those filter lists too).

galacticninja

Posted 2015-09-29T08:56:43.613

Reputation: 5 348

0

In AdblockPro I was able to block the div by adding this rule:

startpage.com###sponsored_csa1

I used the ABP Element Hiding Helper to select the parent div for me and accepted its default rule.

AdBlock Edge is a fork of ABP, so I'd expect a rule there to work in ABE as well. However ABE has been discontinued by it's developer, so you really should either go back to ABP (and just turn off the acceptable ads feature) or switch to uBlock.

uBlock might be the better choice from a technical standpoint as well; it's supposed to have a lighter memory/cpu load in FF than ABP. It also fully works works with the upcoming electrolysis update for Firefox which splits the top level UI and tabs into separate processes and runs the latter at more heavily restricted settings which should make it harder to exploit by malware authors (IE and Chrome have done this for years). It's eta is potentially as early as the end of the year. (FF43/Dec 14 has been their target date for a while; If they make it depends on how well telemetry in the alpha/beta builds look and how small the number of open bugs is.)

Dan is Fiddling by Firelight

Posted 2015-09-29T08:56:43.613

Reputation: 2 677