: Parent.dataLayer.push when iFrame is on https I want to send information from an iFrame into the parent page using a parent.dataLayer.push, see: https://stackoverflow.com/questions/22382182/google-tag-manager-datalayer-within-iframes/
I want to send information from an iFrame into the parent page using a parent.dataLayer.push, see: stackoverflow.com/questions/22382182/google-tag-manager-datalayer-within-iframes/23095522#23095522
Unfortunately I have an issue with this workaround as the iFrame page is on https and the parent on http, as a result this does not work. Does someone know how to make this work anyway?
More posts by @Speyer207
1 Comments
Sorted by latest first Latest Oldest Best
Because the two frames are using different "schemes" (aka "protocols"), browsers will consider them to be on different " origins". This means they aren't allowed to communicate with each other using normal means (i.e. direct access to each others' objects).
The only way around this is to use some form of "cross-origin communication". If you're only targeting modern browsers (i.e. IE8+), you can use the post-message APIs:
developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.