/
How can I reset the browser through Javascript?
How can I reset the browser through Javascript?
This first command will create a new body element.
document.body = document.createElement('body');
We still have the head element with any styling that is present. You can see this by putting in some simple markup:
document.body.innerHTML = '<h1>A heading</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:
document.head.innerHTML = ''
One is still left with any Javascript code which is present. Haven’t thought of an easy way to clear that yet.
Here’s the lot in one easy code fragment to copy paste into the Javascript console:
, multiple selections available,
Related content
DOM Element
DOM Element
More like this
How do I change the content of a DOM element?
How do I change the content of a DOM element?
More like this
Iterate through Javascript object
Iterate through Javascript object
Read with this
The Javascript console and Developer Tools in Chrome
The Javascript console and Developer Tools in Chrome
More like this
How do I get a DOM element into a Javascript variable?
How do I get a DOM element into a Javascript variable?
Read with this
Change CSS property of a DOM element
Change CSS property of a DOM element
More like this