Question

Trying to send a form to another domain inside Facebook iframe on a Facebook app.

I have a form similar to this:

<form id="email_capture" action="{GOES TO ANOTHER DOMAIN}" method="POST">
                <input id="fname_capture_field" placeholder="Enter Your First Name" type="text">
                <input id="lname_capture_field" placeholder="Enter Your Last Name" type="text">
                <input id="email_capture_field" placeholder="Enter Your Email Address" type="text">
                <input id="phone_capture_field" placeholder="Enter Your Phone Number" type="text"><br/>
                <a id="email_capture_btn" href="#"></a>
                <p class="email_capture_error"></p>
            </form>

And it sends correctly if I go to the direct URL and use the form, but if I go through and use it as a Facebook app through an iframe, I get this error.

Display forbidden by X-Frame-Options

I've seen this article already, but I don't have access to the other domain.

Any idea what I should do? Do I have to contact the other domain and get them to allow iframes?

Was it helpful?

Solution

You contact other domain to let you display their page inside an iFrame or you use _target and change the page:

<form id="email_capture" action="{GOES TO ANOTHER DOMAIN}" method="POST" target="_top">
                <input id="fname_capture_field" placeholder="Enter Your First Name" type="text">
                <input id="lname_capture_field" placeholder="Enter Your Last Name" type="text">
                <input id="email_capture_field" placeholder="Enter Your Email Address" type="text">
                <input id="phone_capture_field" placeholder="Enter Your Phone Number" type="text"><br/>
                <a id="email_capture_btn" href="#"></a>
                <p class="email_capture_error"></p>
            </form>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top