Skip to main content

Posts

Showing posts with the label image

Empty image src can destroy your site

Empty image src can destroy your site        This is a problem I�ve come across frequently, and since it has come up again recently, I thought I�d explore this issue in the hope that it will save others some trouble. There are so many problems that this one issue can lead to that it�s baffling browsers still behave this way. The issue? An HTML image, either via <img> tag or JavaScript Image object, that has its src set to �� (an empty string). The offending code       There are basically two patterns to identify. The first pattern is just straight HTML: <img src="" > The second pattern is JavaScript and involves the dynamic setting of the src property on either a newly created image or an existing one: var img = new Image(); img.src = ""; Both patterns cause the same effect: another request is made to your server. There are two different ways that browsers do this. Internet Explorer makes a request to the directory i...