DEV Community

Cover image for This Image is Also an HTML Webpage
Ben Halpern
Ben Halpern Subscriber

Posted on

6

This Image is Also an HTML Webpage

Here is an image:

Also an HTML page

But it is also an HTML page. Here is the markup for the above image:

<img src="http://lcamtuf.coredump.cx/squirrel/" />
Enter fullscreen mode Exit fullscreen mode

Now try visiting that webpage:

http://lcamtuf.coredump.cx/squirrel/

Pretty cool, eh?

I did not make this. I am just showing you because it is cool.

Here is an explanation of what is happening:

  1. The file is a valid jpeg file with some html in metadata.
  2. The server responds with Content-Type: text/html, making browser interpret the response body as html.
  3. Browser ignores jpeg header until it sees and starts to render the html.
  4. The html in the jpeg metadata ends with "<!--" , which starts html comment.
  5. The html has that renders the file as image.

I found this hack fascinating, and I hope you did too.

Image of Stellar post

How a Hackathon Win Led to My Startup Getting Funded

In this episode, you'll see:

  • The hackathon wins that sparked the journey.
  • The moment José and Joseph decided to go all-in.
  • Building a working prototype on Stellar.
  • Using the PassKeys feature of Soroban.
  • Getting funded via the Stellar Community Fund.

Watch the video

Top comments (0)

Jetbrains image

Build Secure, Ship Fast

Discover best practices to secure CI/CD without slowing down your pipeline.

Read more

👋 Kindness is contagious

If you found this post useful, please drop a ❤️ or leave a kind comment!

Okay