Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trigger all page lifecycle events from script

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.

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.
Is there an easier and cleaner way to get the same result?

Thanks.

like image 871
Svarog Avatar asked Nov 14 '22 00:11

Svarog


1 Answers

what about

$('html').html(new_html_body);
like image 174
Peter Avatar answered Jan 02 '23 09:01

Peter