The following couple of commands will clear out all the HTML and any CSS style sheetsThis first command will create a new body element.
Code Block | ||
---|---|---|
| ||
document.body = document.createElement('body'); // This creates a new body element document.head.innerHTMLelement |
We still have the head element with any styling that is present. You can see this by putting in some simple markup:
Code Block | ||
---|---|---|
| ||
document.body = '';<h1>A // This clears the head elementheading</h1><div class="BLOCKone">Block</div>'; |
You will probably see that the heading is styled in the way that the website you are looking at styles headings.
We can clear that out using:
Code Block |
---|
document.head.innerHTML = '' |
One is still left with any Javascript code which is present. Haven’t found thought of an easy way to clear that yet.