Wed 7th Feb 2007 at 00:00

IE printing dynamic images BUG!

After several days of frustration and trawling through code, I have finally found out how I can get round an issue (BUG in my books) with IE and printing of images within a secured area.

It seems that IE does not pass any cookies to scripts which when the script is protect via session based authentication, the resulting script is not authorised thus resulting in a broken image being printed.

Prior to discovering this, I would appear to be been looking in the wrong place, I initially thought it was that IE was not caching the image (which is actually true), so I wasted a lot of time tweaking the headers that my scripts outputted. All in vain!

I finally found a reference to a nice little piece of software called ieHTTPHeaders which allowed me to view what was going on in IE when yu click the print button (or the print preview, which saved me a lot of paper!). It allowed me to see the headers that IE sent and those that came back from my script, revealing that my script was sending back the header:

LOGGED_IN) { header("Location: /login/"); exit; } ?>Resulting in a HTTP/1 302 and the following being passed back to the browser:
Location: /login/

I found that no matter what I did I could not make IE passed the Session ID cookie so that authentication could take place and making these images publicly viewable was definitely not an option. The answer to my woes came very quickly after pin pointing the problem (as always seems to be the case). When I referenced he script, I simply embedded an authorisation code into the url hat would allow me to authenticate for this pictures.

While this solution is proving to be successful, I am not wonderfully happy at having to reveal this authorisation code to the browser as I believe it to be insecure, but atm it is fixing the problem and is making the users of the system very happy. If you know of a better solution or a work round for this issue (BUG!!!) in IE then please contact me via my contact page.


This site uses cookies, please read my cookie policy.