Trigger all page lifecycle events from script
<p>I have a page's html stored in a string.
I want to replace the whole html of the displayed page with the html in my string, and then trigger all the page lifecycle events such as document.ready, window.load, etc.<br/></p>

<p>I though about using the filesystem API - writing the html into the file system and then redirecting to it. Not sure if it's workable, though, and it is definitely an overkill.<br/>
Is there an easier and cleaner way to get the same result?</p>

<p>Thanks.</p>
