How to replace the whole page with Greasemonkey?

Is there a way to replace the entire webpage with Greasemonkey?

Basically a redirect, but the address bar still shows the source address.

I want the source address to be displayed, but I want to download the modified web page from my hard drive without any knowledge.

+4
source share
3 answers

mh ... this should change the contents of the page

unsafeWindow.document.documentElement.innerHTML='DEFACED!!!!!!1!!!' 

You can rely on GM_xmlhttpRequest() to get this content.

The real problem here is at what point greasemonkey starts; that is: too late for the user to not notice what happened.

I'm not sure what you are trying to achieve here. Is this a prank or user access scheme to the laboratory?

In any case, so that the user does not notice that in the end you will need to do one of two things:

  • write a full-fledged firefox extension that hits earlier than GM at boot time,
  • add an opaque proxy server.
+4
source

Yes, you could do it. How much this will depend heavily on how complex the source and landing pages are. If they are both simple html, this will be easy. If one or the other or both have a lot of fancy styles and scripts, this might be a little complicated, but that would be possible.

One simple way could be to create an iframe that fills the entire page?

Or, collapse all child elements of the body tag and remove them; then insert an iframe or paste the contents of another page as innerHTML.

0
source

The easiest way I could do this is to delete the contents of the body, insert an iframe (100% x100%) and set its source to the path of your choice.

-2
source

All Articles