Hiding Reddit’s obnoxious “Get the Reddit app” pop-up

I’m back using Android and found that Vivaldi’s mobile app now supports Chrome extensions. That means you can hide Reddit’s persistent pop up asking you to use its app instead of a browser.

Here’s how to hide it:

  • Install Violentmonkey which lets you run scripts on web pages.
  • Tap the extension icon in Vivaldi, select Manage Extensions.
  • Under Violentmonkey, hit the “Details” button and select “Allow User Scripts.”
  • Open the Violentmonkey extension, hit the + button, and remove the text that’s there.
  • Paste this and hit “Save”:
// ==UserScript==
// @name         Hide Reddit app banner
// @match        https://*.reddit.com/*
// @run-at       document-idle
// @grant        none
// ==/UserScript==
(function () {
  const TEXT = 'Get the Reddit app';
  function fixedAncestor(el) {
    let n = el, found = null;
    while (n && n !== document.documentElement) {
      const p = getComputedStyle(n).position;
      if (p === 'fixed' || p === 'sticky') found = n;
      const root = n.getRootNode();
      n = n.parentElement || (root instanceof ShadowRoot ? root.host : null);
    }
    return found;
  }
  function sweep(root) {
    root.querySelectorAll('*').forEach(el => {
      if (el.shadowRoot) sweep(el.shadowRoot);
      const t = el.textContent || '';
      if (t.includes(TEXT) && t.length < 200) {
        const a = fixedAncestor(el);
        if (a && a.getBoundingClientRect().height < 200)
          a.style.setProperty('display', 'none', 'important');
      }
    });
  }
  let timer;
  const run = () => { clearTimeout(timer); timer = setTimeout(() => sweep(document), 300); };
  new MutationObserver(run).observe(document.documentElement, { childList: true, subtree: true });
  sweep(document);
})();