[Solved] Side effects having an html page with just an img tag?


The html, head and body elements are always going to be there. You can’t actually have an HTML page without them, even if you leave out the tags.

The following two valid HTML documents are equivalent (whitespace notwithstanding):

<!DOCTYPE html>
<title>Image</title>
<img src="https://stackoverflow.com/questions/48771175/lightbulb.jpg" alt="">
<!DOCTYPE html>
<html>
  <head><title>Image</title></head>
  <body><img src="https://stackoverflow.com/questions/48771175/lightbulb.jpg" alt=""></body>
</html>

So even if there were any such security risks associated with leaving those elements out (which there aren’t), the fact that they will always be there renders that concern moot.

1

solved Side effects having an html page with just an img tag?