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/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?

1 Answer 1


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:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.