2

I use iFrames to display secure forms within our websites so that I can have the forms stored on a secure server but the websites themselves don't have to be.

Once the user submits the forms and the data has been put in the database I would like to have them redirected to a thank you page on the website.

I have tried

header('LOCATION: http://www.site.net');

and

echo '<META HTTP-EQUIV="Refresh" Content="0; URL="http://www.site.net">';

I have also searched through this site and can't find an answer to this.

Thank you in advance for any help you can offer.

Paul Hume
  • 67
  • 1
  • 8

1 Answers1

3

You need to tell the parent window (iframe container) to do a redirection using the DOM object window.top

Javascript:

window.top.location.href = "http://www.site.net/saythankyou"; 
cardeol
  • 2,218
  • 17
  • 25
  • If the user got javascript disabled browser won't it cause troubles I mean he won't be redirected. – Tifa Jun 06 '14 at 08:41
  • 3
    The user must have javascript enabled, there is no way to get the parent window in the server side, remember an iframe is an additional instance of the browser. You should take control with javascript. – cardeol Jun 06 '14 at 08:43
  • Thanks for your answer. Didn't know it was the only solution we had. – Tifa Jun 06 '14 at 08:47
  • I agree, there is no way around this with Javascript disabled. User experience could be improved by showing a "thanks, please click to return to main site" when javascript is disabled. – lukeocodes Jun 06 '14 at 08:47