开发者

Is There a Quick Way to Make Firefox Open a Page Without Loading Scripts Or Images?

I'm currently working on a method to automatically identify certain types of spam. My research for this is causing me to run into a ton of phishing attempts and nasty, nasty porn. Adding a web开发者_JS百科site I'm about to open to the images exception list in Firefox preferences is a lengthy process. Is there a quick way (perhaps through a plugin) for me to signify I want to open a page without loading any of its scripts or images?


You can use Adblock Plus and add a filter like *$domain=yahoo.com - any web page from yahoo.com won't be allowed to load anything then. If you want to automate this task, this filter can also be added by running the following code from a privileged context, e.g. from the Error Console:

Components.utils.import("chrome://adblockplus-modules/content/Public.jsm", null)
                .AdblockPlus.addPatterns(["*$domain=yahoo.com"]);

And removed by running:

Components.utils.import("chrome://adblockplus-modules/content/Public.jsm", null)
                .AdblockPlus.removePatterns(["*$domain=yahoo.com"]);

Documentation of the public API of Adblock Plus: https://adblockplus.org/en/IAdblockPlus (I simplified the way this API is accessed because I assume that compatibility with old Adblock Plus versions and Firefox versions before Firefox 4 is irrelevant here).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜