Commit b670341
committed
fix: resolve cross-origin iframe access error in Authoring MFE with GTM
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].offsetHeight` to get initial dimensions.
When GTM is present, `window.parent[0]` references GTM's cross-origin
iframe 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.scrollHeight` and
`document.documentElement.scrollWidth` to get the current document's
dimensions 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.1 parent 480a445 commit b670341
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
218 | | - | |
219 | | - | |
| 218 | + | |
| 219 | + | |
220 | 220 | | |
221 | 221 | | |
222 | 222 | | |
| |||
0 commit comments