How to enable session cookies in IE in iframes website

I am here going to discuss solution to a  particular scenario in which Internet Explorer 6/7/8 rejects your session. If your application works inside an iframe which belongs to another domain than the parent domain than IE will not be able to set cookies for it. Hence you could not work with session variables. A common example of an iframe application is facebook apps and facebook games.

The solution to it is to implement P3P header that will tell IE that cookies inside iframes are ok for user privacy.  P3p stands for Platform for Privacy Preferences (P3P). To implement P3P header include this header at the starting of your php file.

<?php header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"') ?>

Tags: , ,

Leave a Comment