How does Adblock Plus block addresses?
For developers: to register a content policy you have to write an XPCOM component that should implement the nsIContentPolicy interface. Make sure to adjust the module’s registerSelf method to register your component in the “content-policy” category (use the category manager for this). That’s it, now your component’s shouldLoad method will be called and you can decide whether the specific request should be accepted or not.
How does Adblock Plus process its filters and which filters are faster?
All filters a translated into regular expressions internally, even the ones that haven’t been specified as such. For example, the filter
adbanner.gif| will be translated into the regular expression
/ad.banner.gif$/. However, when Adblock Plus is given an address that should be checked against all filters it doesn’t simply test all filters one after another — that would slow down the browsing unnecessarily.
Besides of translating filters into regular expressions Adblock Plus also tries to extract text information from them. What it needs is a unique string of eight characters (a “shortcut”) that must be present in every address matched by the filter (the length is arbitrary, eight just seems reasonable here). For example, if you have a filter
|http://ad.* then Adblock Plus has the choice between “http://a”, “ttp://ad” and “tp://ad.”, any of these strings will always be present in whatever this filter will match. Unfortunately finding a shortcut for filters that simply don’t have eight characters unbroken by wildcards or for filters that have been specified as regular expressions is impossible.
All shortcuts are put into a lookup table, Adblock Plus can find the filter by its shortcut very efficiently. Then, when a specific address has to be tested Adblock Plus will first look for known shortcuts there (this can be done very fast, the time needed is almost independent from the number of shortcuts). Only when a shortcut is found the string will be tested against the regular expression of the corresponding filter. However, filters without a shortcut still have to be tested one after another which is slow.
To sum up: which filters should be used to make a filter list fast? You should use as few regular expressions as possible, those are always slow. You also should make sure that simple filters have at least eight characters of unbroken text (meaning that these don’t contain any characters with a special meaning like *), otherwise they will be just as slow as regular expressions. But with filters that qualify it doesn’t matter how many filters you have, the processing time is always the same. That means that if you need 20 simple filters to replace one regular expression then it is still worth it. Speaking of which — the deregifier is very recommendable.
The filter matching algorithm in detail
How does element hiding work?
Element hiding rules are translated into CSS and applied to all web pages the user is visiting. A rule like
example.com#div(evil_ad) then looks like:
display: none !important;
@-moz-document is a proposed extension to the CSS standard, you can read more about it in theMozilla Developer Center.
Rules that are not restricted to a certain domain will be restricted to the protocols http:// and https:// to prevent them from hiding elements of the browser’s user interface (it is using the chrome:// protocol scheme). For example the rule
#div(evil_ad) will be translated into:
display: none !important;
For developers: Adblock Plus is using the stylesheet service here. This interface came with Gecko 1.8 and allows extensions to add user stylesheets dynamically (before that you could only modify userContent.css which requires you to restart the browser). User stylesheets will overwrite CSS code of all web sites, they have the highest possible importance.
[alert style=”yellow”] This is what we found on adblockplus wiki[/alert]
[alert style=”yellow”] Source : adblockplus wiki[/alert]
How AdBlockPlus give effect to bloggers
With Adblock many users wanted to block ads from youtube,but meanwhile when you surf website example my website the advertisement in this website also will be hidden.In this case the adblock will make our revenue decreased and hard to earn money from that ads.