tag:blogger.com,1999:blog-158104178192097877.post3830266897920758749..comments2023-09-09T22:31:24.624+08:00Comments on Dirty Words: Empty ImageUrl results in empty src and duplicate requestMichael Haneshttp://www.blogger.com/profile/01877569030107816208noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-158104178192097877.post-7009225243539970432010-12-03T08:16:25.394+08:002010-12-03T08:16:25.394+08:00Hi Ryan,
Some good thoughts and an interesting us...Hi Ryan,<br /><br />Some good thoughts and an interesting use of NOSCRIPT. <br /><br />The majority of the site in question is probably invalid so it's not something I worry about very often but a valid point nonetheless. In terms of JS support, we've made that call based on the percentage of visitors with JS *enabled* (99%+). The accessibility issue bothers me but I'm not sure having an empty image would address that. <br /><br />Btw, this image is is getting set client-side for functional reasons, not for performance (it's a weather forecast icon which may change as the user changes the current town selection). I did consider setting a default image (eg. sunny) but decided not to due to the possibility of one more unnecessary request on top of the 90+ requests the homepage already makes... we've recently changed this control to use a sprite so I may revisit that decision.Michael Haneshttps://www.blogger.com/profile/01877569030107816208noreply@blogger.comtag:blogger.com,1999:blog-158104178192097877.post-53547959683849195492010-12-03T01:37:59.025+08:002010-12-03T01:37:59.025+08:00I assume you are loading images later for performa...I assume you are loading images later for performance. However, serving an image without a SRC attribute is invalid, as both SRC and ALT are required. Also, by serving empty SRC attributes, you are not following best practices in terms of progressive enhancement. You are essentially blocking image to all users with javascript disabled (which includes some screen readers and most bots)... which is not ideal.<br /><br />A better, but less than ideal fix is to use a blank image or placeholder image. This results in only 1 request that can be cached on the client on the first page view.<br /><br />A even better, but still less than ideal solution is to wrap your images in a NOSCRIPT tag, and then using javascript (jQuery), you can remove the NOSCRIPT tags... leaving behind the actual content of the NOSCRIPT. This would be indexable, accessible, and gracefully degrade when javascript is disabled.Ryan Whealehttps://www.blogger.com/profile/00727450608887637147noreply@blogger.com