Forum Moderators: coopster

Message Too Old, No Replies

Setting Cookies

Working around the two page download to test acceptance

         

otem

1:57 am on Feb 13, 2007 (gmt 0)

10+ Year Member



I'm very interested in assigning my site visitors tracking cookies, that's just the kind of person I am.

I'm pretty comfortable with the process, and I'm even aware of some of the disadvantages too.

I know using PHP you can assign a cookie, but you need the visitor to go to a second page to test weather the visitor has accepted it or not.

Personally, I'm not a big fan of having to wait around for the visitor to travel to a second page before I can see if my cookie was accepted or not; so I'm trying to find a way around that.

Say I have a page where I want to assign a cookie. Would I be able to embed two images into the page; with the first image, when loaded, would actually run a PHP script that assigns the visitor cookie and return a null image. Then the second image, which would also run a PHP script that returns a null image, could simply detect if the cookie was accepted or not?

I could use javascript to stagger the loading of these images, so the second one will occur after the first, and not be required to be embedded.

Any thoughts?

mcibor

4:19 pm on Feb 13, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You don't need two pictures for that: one would be sufficient.

In the main page set the cookie, in the picture (it should be a real picture, otherwise you would get a nasty cross - no picture found) check for the cookie, and voile.

No need to stag the loading, cause cookies are set in headers, the same goes with reading them.

Regards
Michal