Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save ian4kasablancas/308d6b37bccb524f260fad4638c0615a to your computer and use it in GitHub Desktop.

Select an option

Save ian4kasablancas/308d6b37bccb524f260fad4638c0615a to your computer and use it in GitHub Desktop.
Removes ALL sponsored ads from Startpage search results reliably
// ==UserScript==
// @name Startpage - Remove Sponsored Ads (Advanced Filter)
// @namespace https://startpage.com/
// @version 2.0
// @description Removes ALL sponsored ads from Startpage search results reliably
// @match https://www.startpage.com/*
// @match https://startpage.com/*
// @grant none
// @run-at document-start
// ==/UserScript==
(function() {
"use strict";
function removeAds() {
const selectors = [
"#gcsa-top",
"#gcsa-bottom",
'iframe[src*="/ads"]',
'iframe[title="Ads by Google"]',
'iframe[name*="master"]'
];
selectors.forEach(sel => {
document.querySelectorAll(sel).forEach(el => {
el.remove();
});
});
}
// Run as soon as possible
document.addEventListener("DOMContentLoaded", removeAds);
// Watch for dynamic changes (infinite scroll, page change, etc.)
const observer = new MutationObserver(removeAds);
observer.observe(document.documentElement, {
childList: true,
subtree: true
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment