6

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?

2

3 Answers 3

6

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 ?
3
  • Does this solve the issue?
    – Mahi M
    Commented Jun 28, 2019 at 7:28
  • any reason you don't use jQuery(elem).prop('src').indexOf(window.location.href) != -1 ?
    – NathanielR
    Commented Aug 6, 2019 at 20:45
  • @Vvvaida: superb..it's working perfect..thanks for save my time....:-) Commented Oct 21, 2019 at 15:38
0

To build on Vvaida's answer: there may be instances where the iframe src may contain a reference to the local domain name as a URL parameter, and will then incorrectly match. Use the following to ensure you are only checking the domain name in the src:

return jQuery.nodeName( elem, "iframe" ) != -1 &&
                jQuery(elem)
                    .prop("src")
                    .split("?")[0]
                    .indexOf(window.location.hostname) != -1 ?
0

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

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

<-

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

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.