IFrame Messaging from Top level to Order Form Follow
Here is a script which allows you to detect the page you are on when using a MyOrderDesk Iframe.
Build a Field called 'pageurl' to hold the URL of the website.
Example of this in use: https://demo.pagepath.com/ticket-18811/
On the Order Form, you need this script.
<script type="text/javascript">
window.addEventListener("message", function(event) {
if (event.origin == "https://subdomain.example.com" || event.origin == "http://subdomain.example.com") {
if (event.data.indexOf('[iFrameSizer]') == -1)
$("#udf_pageurl").val(event.data);
}
}, false);
top.postMessage("href_request", "*");
</script>
On the Top Level Page, you should place this in the header.
<script type="text/javascript">
window.addEventListener("message", function(event) {
var srcDomain = ".myorderdesk.com";
if (event.data == "href_request" && event.origin.slice(-srcDomain.length) == srcDomain) {
event.source.postMessage(window.location.href, event.origin);
}
}, false);
</script>