Get the latest tech news

How to Create HTML/ZIP/PNG Polyglot Files


Learn how to create HTML/ZIP/PNG polyglot files in JavaScript

The assets/main.js script on this “bootstrap page” reads the ZIP data by calling fetch(””) and uses the lib/zip.min.js JavaScript library to extract it. However, there’s a problem: due to the same-origin policy, retrieving ZIP data directly with fetch(””) fails when the page is opened from the filesystem (except in Firefox). For the last point, “consolidation data” in a JSON script tag is added in the bootstrap page.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of zip

zip

Photo of HTML

HTML

Photo of png polyglot files

png polyglot files

Related news:

News photo

RIP W3C's HTML working group 1994-2024

News photo

Building HTML in Go

News photo

Nokolexbor: Drop-in replacement for Nokogiri. 5.2x faster at parsing HTML