Monday, January 29, 2007

Frames and Cookies (how to)

Internet Explorer (or any other Browser) may prevent the use of cookies (and consequently sessions) when HTML frames point to files located in different servers. A possible solution to that "error" involves setting up a proper Privacy Policy (see "Platform for Privacy Preferences Project - P3P" link bellow). You can do that by sending the following HTTP header data to the client system:

P3P: CP="CAO PSA OUR"

Here is the code in PHP:
<?php header('P3P: CP="CAO PSA OUR"'); ?>

For more info:

http://james.jamesandkristin.net/2005/11/18/php-session-cookie-in-frames-using-internet-explorer/

http://www.w3.org/P3P/

Carpe Diem,

No comments: