Hacker News new | ask | show | jobs
by Hannan 3600 days ago
He placed HTML inside a COM (comment) segment of the JPEG, which is perfectly legal. The ending of his HTML is "<!--" which starts an HTML comment, telling the browser to ignore all the data which follows (the image data). Since browsers are liberal in what they accept, they ignore the first 20ish bytes of the JPEG header, see the starting HTML tag, render the page, and ignore the fact that the comment never closes.

http://dev.exiv2.org/projects/exiv2/wiki/The_Metadata_in_JPE...

1 comments

Actually the browser isn't ignoring the first bytes of the JPEG before the <html> tag - it's there on the page, just hidden with CSS.
For example, see how it renders in a text browser (links here):

https://imgur.com/a/WVWpU

That's true, I stand corrected.