8

In some web pages entering with adblock installed is added in the body the "overflow:hidden" css style, preventing the scroll of a website.

Example:

<html>
  <head>
      <title>Website</title>
  </head>
  <body style="overflow: hidden;">
    Some long article content
  </body>
</html>

I have to manually edit in Chrome web inspector to remove each time, which is annoying.

I would like know I could make this removal permanent or detect via a chrome extension or adblock rule to remove it or maybe via a direct javascript, etc.

UPDATE: Using tampermonkey chrome extension, probably I could reach my goal. I did the following script without result (the page seems reload or load some javascript and I cannot remove properly the body overflow hidden):

// ==UserScript==
// @name         InvestingRemoveScrollBodyBlocker
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Remove body overflow hidden
// @author       Ángel Guzmán Maeso <angel@guzmanmaeso.com>
// @match        https://*.investing.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    setTimeout(function(){

        var bodyWeb = document.getElementsByTagName("BODY")[0];
        console.log(bodyWeb);
        bodyWeb.style.overflow = "visible !important";

    }, 4000);

})();
Irina
  • 786
  • 1
  • 11
  • 25
shakaran
  • 10,612
  • 2
  • 29
  • 46
  • Maybe injecting a CSS rule to override this via extension would help. For example body{overflow: auto! important;} – K K Jul 13 '18 at 17:39
  • I think you're talking as a user of adblock. This is then not a programmer's question. Please contact adblock. – KIKO Software Jul 13 '18 at 17:41
  • You can't specify !important in a direct property assignment. You can do document.body.style.cssText = 'overflow: visible !important'; – wOxxOm Jul 13 '18 at 19:01

2 Answers2

9

You can add a uBlock Origin filter rule with a :style() operator to override this:

*##html,body:style(overflow: visible !important;)
Martin Valgur
  • 5,793
  • 1
  • 33
  • 45
5

Try this script tool TamperMonkey

To override overflow

body {
   overflow: visible !important;
}

The script that will work with TamperMonkey:

// ==UserScript==
// @name         InvestingRemoveScrollBodyBlocker
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Remove body overflow hidden
// @author       Ángel Guzmán Maeso <angel@guzmanmaeso.com>
// @match        https://*.investing.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    // Credits: https://stackoverflow.com/questions/51330252/how-to-remove-the-css-rule-body-overflowhidden-automatically
    document.body.style.cssText = "visible !important";
})();
shakaran
  • 10,612
  • 2
  • 29
  • 46
Irina
  • 786
  • 1
  • 11
  • 25