Skip to content

Instantly share code, notes, and snippets.

@yocontra
Forked from lakenen/detectanimation.js
Created June 28, 2012 20:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yocontra/3013658 to your computer and use it in GitHub Desktop.
Save yocontra/3013658 to your computer and use it in GitHub Desktop.
JavaScript animated GIF detection!
isAnimatedGif = (src, cb) ->
request = new XMLHttpRequest()
request.open "GET", src, true
request.responseType = "arraybuffer"
request.addEventListener "load", ->
arr = new Uint8Array request.response
return cb false if arr[0..3] isnt [0x47,0x49,0x46,0x38]
request.send()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment