Adblock Plus 在 Chrome 中到底如何工作?

发布于 2024-12-24 18:32:09 字数 99 浏览 1 评论 0原文

我注意到 Adblock Plus 注入了一些隐藏广告的 CSS,但我认为它的作用不止于此 - 例如阻止 HTTP 请求。

Adblock Plus 如何拦截网络广告?

I noticed Adblock Plus injecting some CSS that hides the advertisements, but I think that it does more than that - for example blocking HTTP requests.

How does Adblock Plus block advertisements on the web?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

苍白女子 2024-12-31 18:32:09

Adblock Plus 有两种机制来阻止网站上的内容:

元素隐藏:在网站中注入 CSS 片段,以隐藏应该阻止的元素。这样,广告就会从呈现的页面中完全删除,以便原本用于广告的区域现在将用于网页的实际内容,甚至是网页本身的一部分的内容(例如文字广告)也可以被封锁。然而,这并不能阻止资源加载。

请求阻止:用于检索本应被阻止的资源的 HTTP 请求将被阻止加载。这将使页面加载速度更快,减少流量,甚至可以阻止从 Flash 中加载的内容,例如 YouTube 上的视频广告。

在给定网站上隐藏的元素和要阻止的 URL 都由过滤器列表控制。默认情况下,Adblock Plus 将使用 EasyList。但您可以自由设置自己的过滤规则或配置其他过滤列表。

Adblock Plus has two mechanisms, to block content on websites:

Element hiding: A CSS snippet is injected in the website, to hide elements that are supposed to be blocked. That way the ads are completely removed from the rendered page, so that the areas otherwise used for ads will now be used for the actual content of the web page, and even content that is part of the web page itself (like text ads) can be blocked. However this doesn't prevent resources from loading in the first place.

Request blocking: HTTP requests for retrieving resources that are supposed to be blocked will be prevented from loading. This will make the page load faster, reduce traffic, and even enables blocking content that is loaded from within Flash, like the video ads on YouTube.

Both, the elements to hide on given websites, and the URLs to block, are controlled by filter lists. By default Adblock Plus will use EasyList. But you are free to setup your own filter rules or configure other filter lists.

生生漫 2024-12-31 18:32:09

操作方法如下:https://adblockplus.org/en/faq_internal#elemhide

他们只是用他们在用户代理样式表中掌握的 id 列表(即在浏览器级别及其 JS)禁用广告拦截。

Here it is how it is done: https://adblockplus.org/en/faq_internal#elemhide

They just disable the block the adblock with the list of ids that they have in hand at user agent stylesheet i.e. at your browser level with its JS.

回眸一笑 2024-12-31 18:32:09

他们在这里给出了一个简短的想法:http://chromeadblock.org/extensions/adblock-for -chrome/

但是没有真正的细节。我认为他们所做的是检查 css 类和 id 是否有坏词,例如:广告、广告、赞助......
此外,他们还会有一个主要广告服务器(如 AdWords 等)的列表,并简单地阻止加载这些 IP/域。
之后,它似乎会计算已删除广告的尺寸并用空白 CSS 填充它。

也许他们不是这么做的,但我就是这么做的。

They give a brief idea of it here: http://chromeadblock.org/extensions/adblock-for-chrome/

However no real details. I think what they do is, to check css class and id's for badwords, like: advert, ad, sponsored ....
Furthermore, they'll have a list of major Ad Servers like AdWords etc. and simply block those IP's / domains from being loaded.
Afterwards it seems like it calculates the dimensions of the removed ad and fills it up with a blank CSS.

Maybe thats not how they do it, but that is how I would do it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文