Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Event to know when a form in an iFrame has been submitted

Ok so I have an iframe on the Contact page of my website.

The src of the iframe points to another file containing a Google Docs form.

Once the Google docs form is submitted, the page is redirected to a Google page saying that "your response has been recorded".

I have this form inside an iframe so that it doesn't redirect viewers away from my entire site, but instead only the iframe document is redirected.

This all works fine, But I want to show my own message instead of the Google "your response has been recorded".

To do this, basically I want to know when the iframe has been redirected and/or (preferably) the form has been submitted.

Things i've tried...

  • onhaschange="" inside the iframe element

  • onsubmit="" inside the form element (which is in the iframe src file)

Any other ideas?

like image 731
Jacob Avatar asked Nov 04 '22 18:11

Jacob


1 Answers

Look at this answer: iFrame src change event detection?
Create a function to check if the loaded content is from Google and react properly.

like image 185
Sascha Galley Avatar answered Nov 11 '22 02:11

Sascha Galley