iFrames, IE and session cookies

Posted: November 6th, 2008 | Author: | Filed under: PHP | Tags: , , , | Comments Off on iFrames, IE and session cookies

Session is lost when browsing in an iFrame

A very large problem with a very small solution: For security reasons Internet Explorer prevents carrying over session variables from one page to another when browsing in an iFrame. To enable this we somehow need to tell IE that the page we’re looking at is trusted and safe. This can be done by adding either a meta tag or a header (in this example sent using PHP) to the framed page:

<meta http-equiv="P3P" content='CP="IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA"'>
header('P3P: CP="IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA"');

Solution source: Sitepoint.com