Mysterious additional HTTP GET: beware of the IMG tag!

This morning I solved one of those mysterious problems that cause insomnia, premature baldness and/or random acts of violence such as throwing anything out of the window with an on/off switch.

One of the web forms I’m working on stores an object in the Session scope. The object  is being created on the initial (non-postback) call of the webpage and fetched from the Session on subsequent postbacks. One particular part of the page utilizing AJAX caused the object to be reset to its initial state and that was when the detective work started.

Firebug showed that after loading a dynamic part of the page an additional HTTP GET was done. It turned out to be an IMG tag with an empty src attribute, i.e.

<img src="" />

that was filled in after dynamically inserting the HTML, causing the aforementioned HTTP GET by the browser. The solution was to point the IMG to a valid (empty) image first and overwrite that later.

This reminded me of a similar case I had a long, long time ago in a place near, nearby where a piece of faulty HTML also caused an additional GET. Exercise for the reader:

<body background="#FFF">

(Yes folks, that was in the day that CSS did not exist yet and “Auto-complete” referred to a letter stating that your T-Ford was ready.)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: