I like this idea. I can imagine there might be some complexities around things like:
- What do you do if the
disableScripting() call is not the last statement in the block?
- What would be the effect on
<noscript> elements already encountered when parsing the page
Could it be easier to reload the page? So
disableScripting acts like a
window.reload() but when the page is reloaded it has JS disabled?
Content-Security-Policy: script-src 'none'
disableScripting or equivalent)