在一些安装了adblock的网页中,会在正文中添加"overflow:hidden“css样式,以防止网站滚动。
示例:
<html>
<head>
<title>Website</title>
</head>
<body style="overflow: hidden;">
Some long article content
</body>
</html>
我不得不在Chrome网页检查器中手动编辑每次删除,这是恼人的。
我想知道我可以永久地删除它,或者通过chrome扩展或adblock规则进行检测来删除它,或者可能通过直接的javascript等等。
更新:使用tampermonkey扩展,也许我可以达到我的目标。我做了以下没有结果的脚本(页面似乎重新加载或加载了一些javascript,并且我无法正确删除隐藏的主体溢出):
// ==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);
})();
发布于 2018-07-14 01:45:39
试用此脚本工具TamperMonkey
重写溢出
body {
overflow: visible !important;
}
与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";
})();
发布于 2020-05-22 03:38:43
您可以添加一个带有:style() operator的uBlock Origin过滤规则来覆盖以下内容:
*##html,body:style(overflow: visible !important;)
https://stackoverflow.com/questions/51330252
复制相似问题