doctor_n_
doctor_n_

Reputation: 279

Animated gif won't loop in Safari Chrome or Firefox

When adding gifs to my site I was fully expecting them not to loop automatically; however, on the browsers I currently have installed I am getting some very strange behaviour. For a start the gifs do not loop infinitely even when using this code:

<img src="example.gif" dynsrc="example.gif" loop=infinite />

However, they loop twice rather than once which confused me even more. I couldn't find anything about this online other that what's been stated above so any help would be much appreciated.

Upvotes: 2

Views: 3630

Answers (1)

traktor
traktor

Reputation: 19301

"loop" does not appear within attribute lists for IMG elements specified by any of the HTML3, HTML4 or HTML5 standards.

Like you I have read or seen "loop" described somewhere (and some time ago) but it does not appear to have ever been standardized.

The safest option would be to re-edit the gif files and when saving them specify a loop count of 0 (or infinite if the editor presents that as the choice). You might like to try loop="0" in the IMG tag first but as mentioned I don't think it's standard and could easily fail.

Upvotes: 2

Related Questions