Remove all content using pure JS

前端 未结 9 2387
南方客
南方客 2020-12-03 09:56

I\'m looking for a way to remove the entire content of a web page using pure Javascript -- no libraries.

I tried:

document.documentElement.innerHTML          


        
9条回答
  •  醉酒成梦
    2020-12-03 10:43

    I believe this will do it

    document.clear()  //deprecated
    
    window.location = "about:blank"  //this clears out everything
    

提交回复
热议问题