views:

51

answers:

2

I would like to know if it's possible to execute javascript from embedded .gif file . I can make rewrite to a php file to seem as a gif file and execute the code from there but I'm not faimilar with css/html therefore I was wondering if there is any trick to make seem there is embedded a picture but to execute javascript . I tried img src attribute but is not working as the browser seems to consider it just a simple picture...

A: 

GIF compression is lossy and is not suitable for code. However, the javascript hacker Jacob Seidelin implemented something very similar using pngs: http://blog.nihilogic.dk/2008/05/compression-using-canvas-and-png.html

sunetos
A: 

Not directly answering your question, but you can embed JavaScript into SVG. Although not most browsers support SVG, but most SVG viewers support JavaScript.

yclian