Feeds:
Posts
Comments

Archive for April, 2008

I discovered an odd bug a little while ago where Firefox was loading our pages twice, and IE was loading both the requested page, and our default page while displaying only the requested page. Having done a few searches on the web, I discovered that this was because of a missing image src attribute.

At first glance, this behaviour seems a bit odd. However, it can be explained by the fact that the src attribute is a URI and the HTML spec for URIs says:

“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.”

Let’s say we request the page www.mysite.com/folder/mypage.aspx. When the browser encounters the missing src <img id=”myImage” src=”” />, Firefox will try to load www.site.com/folder/page.aspx again, whereas IE will try to load www.site.com/folder.

So Firefox is following the spec exactly, while IE, though deviating from it slightly, is arguably more sensible because it avoids problems with the form being submitted a second time with no data.

Interestingly, when I tried the site out in Opera, it exhibited neither of these behaviours – it just loaded the requested page once as normal.

More details can be seen at http://forums.mozillazine.org/viewtopic.php?p=3022038

There are also knock on effects with AJAX – see http://geekswithblogs.net/bcaraway/archive/2007/08/24/114945.aspx

Advertisements

Read Full Post »