Manual:Hooks/OutputPageBeforeHTML

Warning
Use this hook at your own risk.
 * Not used for page previews (bug 7050) until 1.11 or so (r25341).
 * Can cause infinite loops (see talk)
 * May fail under certain caching systems
 * Runs on every page load and page view, so increases overhead

Details

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