Why not do it in the proxy ?
Why not just implement it in a proxy (such as Squid) instead of increasing the complexity of the browser ?
It also seems that this kind of functionallity seems better fit to be in a proxy instead of the browser ?
And a note to the commenter about "buy into the policatal agenda":
Remember that by using and/or developing GPL software you are "buying into the political agenda" of Free Software Foundation :)