简体   繁体   中英

html, css, execute javascript from a gif file

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...

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM