How to get the full code of an html document in javascript including dynamically injected html or scripts or css?

Viewed 30

I have search all over internet if get the full code of an html document in javascript including dynamically injected html or scripts or css and cannot find any clue.

So is it possible ? If yes any code snippet ?

1 Answers
document.documentElement.outerHTML

would give you the entire HTML of the current DOM state, including changes made by JavaScript. Not sure what you mean by "including CSS".

If you use it, don't forget to add

<!DOCTYPE html>

at the top

Related