iFrame, captcha, IE7

May 11th, 2009

What does this title mean? iFrame+captcha+IE7 …. means …. trouble!

We have a small php application, pulled into a .NET site through iFrame. Everything was great until we added a captcha image verification.

No Cache

At first, the captcha didn’t always work. So we put in code to tell the browser not to cache our php page:

<META http-equiv=”Cache-Control” content=”no-store, no-cache, must-revalidate”>
<META http-equiv=”Pragma” content=”no-cache”>

This fixed most problem except IE 7.

The search for solution was long and hectic. We tried to add javascript code to the iframe, tried to add a code when calling the captcha.php (captcha.php?code=<?php echo time(); ?>) … in the end, we found out that the problem was actually with the session.

Session

Session values were not kept between pages. The solution worked for us was adding the following line before ANY output:

<?php header(“P3P: CP=\”ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV\””);?>

This solution was from:

http://www.webmasterworld.com/forum21/7458.htm

Kudos!

Please add your comment