Safari, WebKit and alt text for missing images
One of the purposes of the alt attribute
is to provide alternate text that can be shown when an image cannot be displayed, either because it is missing or broken, or because the user has disabled images in their (graphical) web browser.
Most graphical web browsers do display alt text in place of missing images, but there is one notable exception: Safari and most other WebKit-based browsers (iCab, Shiira, Chrome). In those browsers, all you get when an image is missing is either a small blue icon with a question mark in it or a broken image icon.
Beside the decision to display a question mark instead of the more helpful alt text, there are two things that I find particularly odd:
- OmniWeb, which is WebKit-based, does display alt text for missing images. I guess The Omni Group have added support for this on top of WebKit.
- For images that do not have dimensions specified in HTML or CSS, the size of the placeholder is affected by the length of the alt text, even though it is not displayed.
It seems that since it affects the size of the placeholder WebKit is aware of the alt text, but does not display it. I can’t think of any reason not to display alt text for missing images, so I think this should be changed to match the behaviour of other browsers.
Update: Kit Grose kindly informed me that WebKit does in fact display alt text for missing images, but only when the text can fit on one line within the space occupied by the image.
A quick test verifies that, which changes my suggestion from “WebKit should display alt text for missing images” to “WebKit should display alt text for missing images even if it can’t fit on one line within the space the image would have occupied”.