Pack arbitrary files into PNG and access them using JavaScript
1–10 of 31 posts
Re: Pack arbitrary files into PNG and access them using JavaScript
#2Re: Pack arbitrary files into PNG and access them using JavaScript
#3Any ideas why I would want to do this?
Re: Pack arbitrary files into PNG and access them using JavaScript
#4Re: Pack arbitrary files into PNG and access them using JavaScript
#5Re: Pack arbitrary files into PNG and access them using JavaScript
#6Re: Pack arbitrary files into PNG and access them using JavaScript
#7Earlier quoted context omitted.
Getting around the same-origin policy for GET-ing binary resources?
How would this get you around the same origin policy?
I could be wrong, but doesn't that work?
Re: Pack arbitrary files into PNG and access them using JavaScript
#8Earlier quoted context omitted.
How would this get you around the same origin policy?
Instead of doing $.get([remoteScript]), you inject img tags that point to prebuilt PNGs on a different server and decode them after they load. I could be wrong, but doesn't that work?
Re: Pack arbitrary files into PNG and access them using JavaScript
#9Re: Pack arbitrary files into PNG and access them using JavaScript
#10Cody's goal was to compress already minified WebGL code and achieve some pretty impressive results from a ridiculously small file for a demo contest. He also put the JS loader (which is much smaller than the linked decoder) in a custom chunk on the PNG itself. By doing it that way, you can have a PNG that when renamed also contains a web page and/or more Javascript.
It's an interesting technique, for sure, but I've never been able to find a real use for it beyond the compression. With a content-type sniffing vulnerability or something, it could be an interesting way to deliver content to browsers, but otherwise it's really just a curiosity as best I can tell.