Are there any addons that can filter and rewrite the DOM before it get rendered by the browser?
Moderators: FranklinDM, Lootyhoof
Are there any addons that can filter and rewrite the DOM before it get rendered by the browser?
I want to filter out stuff on sites before the browser get to it.
Re: Are there any addons that can filter and rewrite the DOM before it get rendered by the browser?
You can hide some elements from a website, but I doubt that you can block them if they come from the first party. I use uBlock Origin to block annoying elements.
-
- Moon Magic practitioner
- Posts: 2986
- Joined: 2015-09-26, 04:51
- Location: U.S.
Re: Are there any addons that can filter and rewrite the DOM before it get rendered by the browser?
Take a look at Modify HTTP Response, it allows you to change any kind of http response as you like.
Are you sure that HTML filters are supported in uB0 legacy? I always thought it was not.coffeebreak wrote:uBlock Origin supports HTML filters.
-
- Moon Magic practitioner
- Posts: 2986
- Joined: 2015-09-26, 04:51
- Location: U.S.
Re: Are there any addons that can filter and rewrite the DOM before it get rendered by the browser?
JustOff wrote:Are you sure that HTML filters are supported in uB0 legacy? I always thought it was not.
Apologies, you're right. I didn't read carefully enough.
Re: Are there any addons that can filter and rewrite the DOM before it get rendered by the browser?
@JustOff
Thanks for this addon!
Is there any example of a working filter? I tried a simple one below, but doesn't seem to work:
Doesn't change anything on that page. I also tried regex matching, but doesn't seem to work either.
Thanks for this addon!
Is there any example of a working filter? I tried a simple one below, but doesn't seem to work:
Code: Select all
[["addons.palemoon.org",["/addon/modify-http-response/",["<h1> Modify HTTP Response </h1>","<h1>TEST</h1>"]]]]
Re: Are there any addons that can filter and rewrite the DOM before it get rendered by the browser?
You need to properly deal with regular expressions:
Code: Select all
[["addons.palemoon.org",["/^\\/addon\\/modify-http-response\\/$/",["/<h1>[\\s\\S]+?Modify HTTP Response[\\s\\S]+?<\\/h1>/","<h1>TEST</h1>"]]]]
Re: Are there any addons that can filter and rewrite the DOM before it get rendered by the browser?
Thanks it works now. I haven't have time to play with it, but what's the performance hit? Does it stop after find the first match or does it keep running until the end of document text?
Re: Are there any addons that can filter and rewrite the DOM before it get rendered by the browser?
The extension itself has a fairly high performance, but the result depends on how well the filters you create are optimized, especially when using regular expressions.
Re: Are there any addons that can filter and rewrite the DOM before it get rendered by the browser?
Silent Block (on\off ext to reload rules)
Sample block rules: (# - comments)
[ contentblock-regex.txt ]
Sample whitelist rules:
[ contentblock-whitelist-regex.txt ]
Sample block rules: (# - comments)
[ contentblock-regex.txt ]
[ contentblock-whitelist-regex.txt ]