Manual:Hooks/OutputPageBeforeHTML

Details

 * : the OutputPage (object) to which wikitext is added
 * : the HTML text (string) that is being added

This is probably not the hook you want to use.

If you want to do something on every page exactly once and it doesn't depend on the page content, consider using the BeforePageDisplay hook instead.

If you want to transform the HTML generated by the parser, consider using the ParserAfterTidy hook instead. The results of that hook will be cached in parser cache. You only need this hook if your transformation depends on the current user, or it depends on the current language and you don't want to split the cache, or if you don't want it to be cached for some reason.

Caveats
This hook can be executed more than once per page view if the page content is composed from multiple sources. For example, if the MediaWiki:Talkpageheader localisation message is defined, it is inserted at the top of all talk pages, and the hook is called twice: once for the content from the message and once for the content from the page's wikitext.

If you call an OutputPage method that ends up calling this hook again (such as  or  ), you might end up with an infinite loop. is safe to call.

The result of this hook isn't cached in the parser cache, so don't do anything slow in it (consider using the ParserAfterTidy hook instead).