Support » Plugin: Easy FancyBox » Easy FancyBox – Submit Form Data and Close iFrame

  • Resolved Sue


    I have Easy Fancybox set up to display an iframe automatically when the page loads. Within that iframe content is a form for them to subscribe.

    The form directs to another page on success, but the page is displaying in the iframe. I want the iframe to submit the data, then close the iframe and then display the new page without being in the iframe.

    Do you think that it is possible?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Sue


    Here’s the button code I am working with:

    <input type="hidden" name="SuccessURL" value="" />
    <input id="signup" type="submit" name="signup" value="Send" />
    Plugin Author RavanH


    Hi, it should be possible but how depends on your form setup…

    It may be the easiest to add a so called ‘break-out script’ on that success page. See below for instructions.

    If that is not possible, you might be able to use the function parent.$.fancybox.close();return true; on onsubmit/onclick to close the FancyBox iframe. But it will also make the the form break out if the box on submit fail. Note: this will only work if the iframe content (form) and the parent page are hosted on the same domain. Read more on

    Break-out script instructions

    Use this inside the success page:

    <script type="text/javascript"> !== this.location && ( = this.location);


    If it’s an external page that you have access to, it’s easy. Simply add the snippet anywhere in the head section. But if the success page an external page you do not have modifying access to, it’s not possible.

    If it’s a WordPress page, it might be difficult because you do not want the script to be in every other page on your site, preventing you from displaying the initial form in the iframe. To do this, you might use a plugin like Widget Logic and put the script into a text widget and add a rule that says something like


    (note: ‘thankyou-page-example’ should correspond with the actual success page slug) into the Widget Logic field.



    Thank you!

    I will go the simpler route that you suggested.

    I just created a new external Success page and had it say Thank you! Here is your link for your free gift.

    That new page won’t be in WordPress – but my opt-in content isn’t in WordPress either. I’ve been down so many rabbit holes with this I cannot remember why I made it an external page but there was a reason 🙂

    I’ll put a bit of styling on it and you have solved my headache!

    Your plugin is wonderful and your support is fantastic.

    As an FYI, this is a work around for Constant Contact’s sign up process just not playing nice with my WordPress site. Constant Contact WordPress Plug in for Gravity Form has limitations so I needed to figure out a different way to accomplish what I want. Sweet!

    Thanks again.


Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Easy FancyBox – Submit Form Data and Close iFrame’ is closed to new replies.