Prevent all or some DOM content to be parsed, per website domain

To abort loading of a website, you can simply use the window.stop() method.

When called, when the current script finish running, the parsing of the website stops completely.

For example:

<p>Before scripts</p>
  document.write('<p>Before stop</p>')
  console.log('Before stop')


  document.write('<p>After stop</p>')
  console.log('After stop')
<p>Between scripts</p>
  console.log('Second script')
  document.write('<p>Second script</p>')
<p>After scripts</p>

The above HTML displays:

Before scripts
Before stop

while you can see the following in the console:

Before stop
After stop

That shows that the <script> calling .stop() is fully evaluated, but changes made to DOM after .stop() aren't displayed.

Alternatively, to erase the full DOM content, it might be better to redirect the browser, that solution works even after page load:'about:blank','_self')