Magento – Uncaught DOMException: Blocked a frame with origin

magento2

Magento2.3 Everything looks going over https but we still have a frame with origin error.

Uncaught DOMException: Blocked a frame with origin "https://domain.com" from accessing a cross-origin frame.

    at contents (https://domain.com/static/version1551124171/frontend/Sm/mytheme/nl_NL/jquery.js:3123:47)
    at Function.map (https://domain.com/static/version1551124171/frontend/Sm/mytheme/nl_NL/jquery.js:484:14)
    at jQuery.fn.init.jQuery.fn.(anonymous function) [as contents] (https://domain.com/static/version1551124171/frontend/Sm/mytheme/nl_NL/jquery.js:3128:21)
    at lookup (https://domain.com/static/version1551124171/frontend/Sm/mytheme/nl_NL/Magento_PageCache/js/page-cache.js:27:24)
    at HTMLIFrameElement.<anonymous> (https://domain.com/static/version1551124171/frontend/Sm/mytheme/nl_NL/Magento_PageCache/js/page-cache.js:30:25)
    at Function.each (https://domain.com/static/version1551124171/frontend/Sm/mytheme/nl_NL/jquery.js:370:20)
    at jQuery.fn.init.each (https://domain.com/static/version1551124171/frontend/Sm/mytheme/nl_NL/jquery.js:137:18)
    at lookup (https://domain.com/static/version1551124171/frontend/Sm/mytheme/nl_NL/Magento_PageCache/js/page-cache.js:27:35)
    at HTMLDivElement.<anonymous> (https://domain.com/static/version1551124171/frontend/Sm/mytheme/nl_NL/Magento_PageCache/js/page-cache.js:30:25)
    at Function.each (https://domain.com/static/version1551124171/frontend/Sm/mytheme/nl_NL/jquery.js:370:20)


        **

with this line tagged in jquery.js

**

  contents: function( elem ) {
                return jQuery.nodeName( elem, "iframe" ) ?
                elem.contentDocument || elem.contentWindow.document :
                    jQuery.merge( [], elem.childNodes );
            }

There is no such error on our clone web-store without https.
Ideas how to solve this error?

Best Answer

I sorted my issue by replacing one code line in jquery.js. Location: lib/web/jquery.js | line: +-3122

return jQuery.nodeName( elem, "iframe" ) ?

//with:

return jQuery.nodeName( elem, "iframe" ) && 
jQuery(elem).prop('src').indexOf(window.location.hostname) != -1 ?
Related Topic