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.