[thelist] Cookies and images

Joshua Olson joshua at waetech.com
Fri Feb 4 08:46:36 CST 2005


Simon,

Thank you for you complete example.  I owe you an apology because it looks
like I wasn't 100% succinct.  Clearly, in your example, the cookie that is
set by the image is available on subsequent page loads.  I can honestly say
that I was sure that would work.  What I was looking to do was to read the
cookie AFTER the image loaded in the page, but without a page refresh.  To
test, I fired a function to check for cookies within the image's onload
handler.

Something like this:

<img src="whatever.php" onload="checkforcookies()" />   

<script>
  function checkforcookies()
  {
    alert(document.cookie);
  }
</script>

In case you are wondering, my goal is to pass some meta information (about
1k worth) about the picture back to the browser for parsing and subsequent
display.  The picture may be dynamically changed using javascript.  I was
hoping to avoid spinning off a second call to the server to retrieve this
information.

I have some other techniques in mind if this cannot work, but I was really
hoping there would be a way to make this way work.  :-)  Sort of an
intellectual exercise, as it were.

<><><><><><><><><><>
Joshua Olson
Web Application Engineer
WAE Tech Inc.
http://www.waetech.com/service_areas/
706.210.0168 




More information about the thelist mailing list