Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Howto delete everything inside <html> using pure javascript?

I'm searching a js one-liner to delete everything inside the <html> Tag.

I want to remove the <head>, the <body> and everything else declared outside those.

like image 269
John Avatar asked Jul 20 '26 08:07

John


1 Answers

document.write() will create empty page, or actually the following code:

<html>
  <head></head>
  <body></body>
</html>

But I am not sure if this won't clash if the code will be in external file

like image 100
Zefiryn Avatar answered Jul 21 '26 21:07

Zefiryn