Animated PNG images (APNG) have been around for quite a while in an attempt to add this functionality of the GIF format to PNG images. According to Wikipedia they are supported in Opera (>= 9.5) and in Firefox (>= 3.0). The first frame in the APNG animation is displayed if a browser doesn't support APNG images, since it was defined as an extension of the widely supported PNG format. Suppose you have an animated PNG that you want to show in your site and you want to warn your users if their browsers doesn't support it. How would you do it?
动画PNG图像(APNG)已经存在了很长一段时间,试图将这种GIF格式的功能添加到PNG图像中。根据*,它们在Opera(> = 9.5)和Firefox(> = 3.0)中得到支持。如果浏览器不支持APNG图像,则会显示APNG动画中的第一帧,因为它被定义为广泛支持的PNG格式的扩展。假设您有一个要在您的网站中显示的动画PNG,并且您希望在用户的浏览器不支持时警告您的用户。你会怎么做?
2 个解决方案
#1
Make the first image display for a very short period of time, and have it be a big, ugly error message.
使第一个图像显示很短的时间,并使它成为一个大而丑陋的错误消息。
#2
If the first frame isn't a useful image, and the animation is crucial, it's probably too early be using them in your website. Better to wait until more browsers support it.
如果第一帧不是有用的图像,并且动画是至关重要的,那么在您的网站中使用它们可能为时尚早。最好等到更多浏览器支持它。
If for some reason they're vital and must be used then I'd include an error message in the first frame like Adam Jaskiewicz suggested, however, users that support APNG will see the warning for a brief period of time.
如果由于某种原因它们是至关重要的并且必须使用,那么我会在第一帧中包含一条错误消息,如Adam Jaskiewicz建议的那样,但是,支持APNG的用户将在短时间内看到警告。
Apparently support can be detected as in this article on Ajaxian
显然可以像Ajaxian这篇文章中那样检测到支持
#1
Make the first image display for a very short period of time, and have it be a big, ugly error message.
使第一个图像显示很短的时间,并使它成为一个大而丑陋的错误消息。
#2
If the first frame isn't a useful image, and the animation is crucial, it's probably too early be using them in your website. Better to wait until more browsers support it.
如果第一帧不是有用的图像,并且动画是至关重要的,那么在您的网站中使用它们可能为时尚早。最好等到更多浏览器支持它。
If for some reason they're vital and must be used then I'd include an error message in the first frame like Adam Jaskiewicz suggested, however, users that support APNG will see the warning for a brief period of time.
如果由于某种原因它们是至关重要的并且必须使用,那么我会在第一帧中包含一条错误消息,如Adam Jaskiewicz建议的那样,但是,支持APNG的用户将在短时间内看到警告。
Apparently support can be detected as in this article on Ajaxian
显然可以像Ajaxian这篇文章中那样检测到支持