fix: resolve cross-origin iframe access error in Authoring MFE with GTM #34
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Cherry pick from upstream of the commit
be5a625e64570eb083483bd530462598fca4e891.Fixed a SecurityError that occurred when Google Tag Manager was enabled
and the Authoring MFE embedded Studio content in an iframe.
The bug was in cms/templates/container_chromeless.html where the resize
script used
window.parent[0].offsetHeightto get initial dimensions.When GTM is present,
window.parent[0]references GTM's cross-originiframe instead of the parent window, causing a cross-origin security
error: "Failed to read a named property 'offsetHeight' from 'Window'".
Changed to use
document.documentElement.scrollHeightanddocument.documentElement.scrollWidthto get the current document'sdimensions directly, avoiding cross-origin frame access entirely.
This allows the Authoring MFE to function correctly with Google Tag
Manager and other third-party scripts that inject iframes.