Geeks With Blogs
Jonas Bush

*taptaptap* Is this thing on?

 I ran into an interesting bug recently, where you would get 2 identical requests to the page you were visiting. I wasn't sure where this was coming from, so I poked around a bit. It turns out that having an <img /> tag on a page with an empty src attribute (like so: <img src="" />) causes that image tag to point to the containing page, causing the entire page to get requested again (causing any server-side code you may have to get executed again), but the response just gets thrown away, since the img tag is only expecting an image back from the server, not an HTML document.

The way around this is to remove the src attribute altogether, and you can still set the image source through javascript.



Posted on Monday, July 13, 2009 9:55 AM SQL 2005 | Back to top

Comments on this post: Images being requested twice from the server

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Jonas Bush | Powered by: