Menü schliessen
Created: June 29th 2012
Last updated: May 1st 2020
Categories: Common Web Development
Author: Marcus Fleuti

PHP :: Cookie problems in Internet Explorer 7, 8, 9+ when a website loads the page in an IFRAME

Donation Section: Background
Monero Badge: QR-Code
Monero Badge: Logo Icon Donate with Monero Badge: Logo Text
82uymVXLkvVbB4c4JpTd1tYm1yj1cKPKR2wqmw3XF8YXKTmY7JrTriP4pVwp2EJYBnCFdXhLq4zfFA6ic7VAWCFX5wfQbCC

The problem

When a foreign website is loading our website in an IFRAME it occured that the cookies (which we need for authentication etc.) are not being fetched by the browser through the IFRAME properly. Firefox, Chrome and Safari don't care about this but the Internet Explorer cannot make e.g. a cookie authentication through an IFRAME.

The reason

After some research we found out that this has something to do with the security model of the Internet Explorer and that this behaviour can be bypassed by sending back header information that tell the Browser that it's OK to accept cookies through the IFRAME.

The solution

So our software now just sends back the following header which resolved the issue completly (in PHP code):

header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');