All Collections
Customizable Booking Forms
How to use the success redirect feature from an embedded booking form
How to use the success redirect feature from an embedded booking form
Nicole Ventic avatar
Written by Nicole Ventic
Updated over a week ago

Browser security restrictions don't allow us to redirect the parent window directly. However if you add this code to your page, it should allow our booking form to complete the redirect successfully. (If you have any additional questions, please contact us at support@flexbooker.com)

<script type="text/javascript">

if (window.addEventListener) {

window.addEventListener("message", onMessage, false);

}

else if (window.attachEvent) {

window.attachEvent("onmessage", onMessage, false);

}


​

function onMessage(event) {

// Check sender origin to be trusted

if (event.origin.indexOf("https://a.flexbooker.com") == -1 { return; }


​

var data = event.data;


​

if (typeof(window[data.func]) == "function") {

window[data.func].call(null, data.message);

}

}


​

// Function to be called from iframe

function redirect(url) {

window.location = url;

}

</script>

Did this answer your question?