4 ms·
This is awesome -- you never know when a solution like this might come in handy. Wayyyyy back in the day (NS4, IE4 day) I used the width / height of an image t
by arscan 14y ago
This is awesome -- you never know when a solution like this might come in handy.
Wayyyyy back in the day (NS4, IE4 day) I used the width / height of an image the browser polled every few seconds as a transport mechanism... the only other option (refreshing a hidden frame) caused an irritating "page refresh" clicking noise. This was before XMLHttpRequest obviously and was enough bandwidth for our needs. It worked so well that I believe its still being used in production systems.
I haven't looked at the javascript generated in this animated gif solution, but I assume that it does some stuff that wouldn't work in the pre-IE6 browsers. It would be extremely amazing if it did though.
- old_sound 14y agoThis doesn't use any javascript
- arscan 14y agoAh, I just realized that this simply prints text out in a gif... it doesn't encode text in the gif and then decode it in the browser into text that javascript could manipulate. Too bad. I wonder if that's possible...
- streptomycin 14y agoIt is possible, as you can now get the raw pixel data of an image by copying it to a canvas and using getImageData. <img src="test.gif" id="img"> <script type=text/javascript> var img = document.getElementById("img"); var canvas = document.createElement("canvas"); canvas.width = img.width; canvas.height = img.height; var ctx = canvas.getContext("2d"); ctx.drawImage(img, 0, 0); var imageData = ctx.getImageData(0, 0, canvas.width, canvas.height); </script> Then you can do whatever you want with the pixel data.
- xxbondsxx 14y agoEncoding data into images is certainly possible, albeit sometimes a PITA.
- gfodor 14y agoAwesome. I did this trick too, many years ago. I stole it from Liveperson I think.
- kragen 14y agoWhen we were doing Comet in Netscape 4 and IE4 at KnowNow (in 2000, although Rohit, Adam, and Peyman got the technique working in 1999), we used an endless HTML frame, which simply never stopped loading. We'd spit out a <script> tag whenever there was a new message to deliver. There was an annoying clicking noise in IE, but only when the frame did finish loading because you'd lost your network connection or restarted the server. This eventually got open-sourced as "mod_pubsub".
- riobard 14y agoThere you go, Facebook's BigPipe!