Skip to main content
All CollectionsMeetings and forms
Embedded form and scheduler redirect
Embedded form and scheduler redirect

Redirect to a new page after a user submits an embedded form

Geoff Mina avatar
Written by Geoff Mina
Updated over a week ago

Due to browser security restrictions, iFrames are unable to redirect a parent page directly. The Moxie embedded forms use a mechanism called "Post Message" that allows the iFrame to communicate directly with the parent page that it is embedded within.
​



You can use this feature to support a post submission redirect by including the following code anywhere on the page that has the iFrame hosting the Moxie form:
​

<script type="text/javascript">
window.addEventListener("message", (event) => {
if(event.data === 'FORM_SUBMITTED'){
console.log('form has been submitted');
window.location = 'https://wwww.google.com'
}
}, false);
</script>

If you are looking to redirect after a Moxie meeting scheduler is submitted, use the following version of the redirect code:
​

<script type="text/javascript">
window.addEventListener("message", (event) => {
if(event.data === 'MEETING_SCHEDULED'){
console.log('meeting has been scheduled');
window.location = 'https://wwww.google.com'
}
}, false);
</script>



Simply replace "www.google.com" in the examples above with whatever URL you would like the user redirected to.

Did this answer your question?