5 ms·
Any ideas why I would want to do this?
by jsprogrammer 12y ago
Any ideas why I would want to do this?
- long 12y agoGetting around the same-origin policy for GET-ing binary resources?
- greggman 12y agoHow would this get you around the same origin policy?
- long 12y agoInstead 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?
- lawl 12y agoIt doesn't. You can load the img tag, but the browser will not let you access the image itself from javascript, unless you have the proper CORS headers.
- bshimmin 12y agoQuite right - it will complain that the canvas is "tainted" and won't let you do useful things like calling `getImageData`.
- long 12y agoAh -- useful to know. Thanks for the corrections, folks.
- iso8859-1 12y agoimgur allows any origin
- lawl 12y agoThey ask the server to fetch this URL. The client doesn't upload it.
- deleted 12y ago[deleted]
- A_COMPUTER 12y agoCircumventing censorship; need to move arbitrary data, but only convenient transport is image format.
- grandalf 12y agoImagine if lots of sites added a 1MB image that contained the information that various governments want censored.
- boomlinde 12y agoI think the trick originated in demoscene size coding or possibly js5k. By encoding the script as a PNG you let the browser do the decompression and bootstrap it with some tiny piece of javascript.