I have a Sitecore site where I need to implement an iframe communication solution that requires me to set document.domain = "mydomain.com" in JS in both the parent page (sitecore) and the child page (externally hosted on subdomain).
If I place document.domain = "mydomain.com" in the JS anywhere in my site, Page Editor and Preview in Sitecore both start throwing JS errors like confetti and most functionally it broken. When I remove it, everything goes back to normal. Very strange.
Any thoughts as to why this is happening and how we can work around it? Thanks.