PHP header redirection does nor reload <iframe> in IE

Posted by Marco Demaio on Stack Overflow See other posts from Stack Overflow or by Marco Demaio
Published on 2010-05-31T23:20:38Z Indexed on 2010/05/31 23:23 UTC
Read the original article Hit count: 404

Filed under:
|
|
|
|

When displaying data from DB usually I'm in this situation

  1. I'm in page A.php that shows data from DB,
  2. user performs some action (like edit/delete etc) and page B.php is loaded to perform the action,
  3. once page B performed the action, it redirects browser to page A,
  4. page A is auto reloaded during step (3) therefor it shows an updated situation of the data

In order to make page B to redirect to page A i use a simple PHP

header("Location: " . "A.php", TRUE, 302);

This works well in all situations, except when pages A.php is displaied into an <iframe>: in such a case it does not reload (step 4 does not get done). This seems to happen only in IE7 (don't know about IE8), it works perfectly on FF/Safari. And only when using an <iframe>, if page A.php is not in <iframe> it gest refreshed also in IE7.

In order to solve this I simply added a couple of headers in page A.php to set it to not be cached:

header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past

But I was curious if you migt have exeperienced the same issue too in the past, and if you good give me some advises about this.

Thanks!

© Stack Overflow or respective owner

Related posts about php

Related posts about internet-explorer