PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Target confirmation page to _top

  1. kunidesign
    Member

    I would like to embed a plain Gravity Form into an iframe on a 3rd party site.

    Is there a way to target the confirmation page to _top upon a successful submission so that the thank you page shows up as its own page and not within the iframe.

    If there is a validation error, I'd like the form to stay within the iframe.

    I found another post here where there was a suggest to use Jquery to target it to _blank but there's a catch: when there is an error in the form, it seems to open the error in a new page as well.

    Thanks in advance guys

    Posted 11 years ago on Monday December 31, 2012 | Permalink
  2. I don't believe there is a way to use a php redirect header to force a new window. This is a PHP and browser functionality restriction, not a Gravity Forms restriction. I think you could use a redirect page with a special page template, and add this to the template, to break out of the iframe:

    [js]
    <script type='text/javascript'>
    (function(window) {
      if (window.location !== window.top.location) {
        window.top.location = window.location;
      }
    })(this);
    </script>

    Does that accomplish what you need without any ill effects?

    Posted 11 years ago on Tuesday January 1, 2013 | Permalink
  3. kunidesign
    Member

    Thanks Chris - this is a very interesting idea - I'm taking this out for a spin right now to see how it can work with Google Analytics etc. to capture the info: set the form confirmation to a custom page which then breaks out of the iframe to show the thank you page.

    Really appreciate your feedback on this. I'll keep working away at this by adding a loading animation so that it doesn't show the page within the iframe and add a bit of a delay.

    I saw in another post how you are considering an embed option in the future such as Wufoo etc. - this would be a very welcome addition in the future :-)

    Posted 11 years ago on Thursday January 3, 2013 | Permalink
  4. Which post are you referencing regarding Wufoo? I can't recall that one and don't want to forget about it.

    Posted 11 years ago on Thursday January 3, 2013 | Permalink