Search

4/22/2009

img src attribute

img src attribute
According to the HTML spec, the src attribute of an image is a URI. The URI spec says this:

4.2. Same-document References

A URI reference that does not contain a URI is a reference to the current document. In other words, an empty URI reference within a document is interpreted as a reference to the start of that document, and a reference containing only a fragment identifier is a reference to the identified fragment of that document. Traversal of such a reference should not result in an additional retrieval action. However, if the URI reference occurs in a context that is always intended to result in a new request, as in the case of HTML's FORM element, then an empty URI reference represents the base URI of the current document and should be replaced by that URI when transformed into a request.


As far as I can tell, the implied base URI of a document is the document URI itself, and as images are all independent requests, it seems that Firefox has the "technically" correct behaviour in the case of a null src attribute, although IE is clearly doing the more desirable thing.

ie:
<img> 沒問提, <img src=""> 會 double request. <img src="about:blan">沒問題
ff3 似乎都沒有問題

沒有留言: