Replace any text from any HTML page before displaying it

I would like to hide any text matching the template from any HTML page before it is displayed.

I tried something similar with Greasemonkey:

var html = document.body.innerHTML;
html = html.replace( /some pattern/g, '???' );
document.body.innerHTML = html;

The text that I want to hide is correctly replaced by '???', but for a short while, while the page is loading, I can see the source text. As crescentfresh said, it cannot be fixed using Greasemonkey.

I know that I could use a proxy, for example Proximodo , but I prefer not to install it.

What is the easiest way to do this, knowing that it should work on Firefox?

For those who are interested, I want to use it to hide prices from any page on my girlfriend’s computer, to let her choose a gift.

+3
source share
1 answer

With the extension, you are likely to be able to do this.

I don’t remember exactly, but it is possible that LiveHttpHeaders captures http traffic before it enters the browser, which allows you to delete what you want.

In addition, if instead of waiting for the entire page to load, you replace it in the event DOMNodeInserted, it can be fast enough so that the actual content is not displayed.

, Firefox , ! greasemonkey, . , window.onload, greasemonkey DOMNodeInserted .

( !), , , , XD

+1

Source: https://habr.com/ru/post/1721091/


All Articles