11

The snippet in this post is not working in Chrome (version 55.0), although it works fine in Firefox (version 45.0)

I see the following error message:

Uncaught DOMException: Failed to read the 'contentDocument' property from 'HTMLIFrameElement': Blocked a frame with origin "null" from accessing a cross-origin frame.
    at tb (https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js:3:17863)
    at Jb (https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js:3:21147)
    at n.fn.init.show (https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js:3:23399)
    at n.fn.init.n.fn.(anonymous function) [as show] (https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js:3:30325)
    at HTMLAnchorElement.<anonymous> (http://stacksnippets.net/js:27:37)
    at HTMLAnchorElement.dispatch (https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js:3:6404)
    at HTMLAnchorElement.r.handle (https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js:3:3179)
8
  • 3
    It works if i change ` <script src="ajax.googleapis.com/ajax/libs/jquery/2.1.1/…>` to ` <script src="ajax.googleapis.com/ajax/libs/jquery/3.1.0/…>` Maybe some bug specific in jQuery 2.1.1?
    – Alon Eitan
    Feb 3, 2017 at 17:28
  • 2
    But it works in firefox with the same jQuery version.. Feb 3, 2017 at 18:15
  • 3
    No-repro here in chrome v55 on windows 7.
    – user4639281
    Feb 3, 2017 at 20:40
  • I can repro different behaviors in Firefox 50 vs Chrome 55 in Win7.
    – TylerH
    Feb 3, 2017 at 22:09
  • 2
    On Win10x64: Works in Firefox 51.0.1 and FF54.0a1 (I didn't bother testing other versions of FF), NOT working in Chrome 55.0.2883.87 (64-bit), Edge 38.14393.0.0, IE11.576.14393.0, and Opera 42.0.2393.517.
    – Makyen Mod
    Feb 5, 2017 at 0:27
  • Works for me with Chrome 56.0.2924.87 (64-bit) on Windows 10 Pro. @Makyen Could you also try Chrome 56?
    – tambre
    Feb 5, 2017 at 15:48
  • 1
    @tambre, Fails for me on Chrome 56.0.2924.87 (64-bit). Win 10 Pro x64.
    – Makyen Mod
    Feb 5, 2017 at 16:02
  • 1
    Yes please add allow-same-origin param in stacksnippets sandbox attribute. Too many codes fail because of it. Here is a fiddle where I can repro OP's issue, and here is one where it has been fixed thanks to this param. The security shouldn't be compromised, since snippets are loaded from a different origin anyway (stacksnippets.net). The only concern I can think of would be that one could save / get a localStorage item across different snippets. (Ps: I can repro on chrome 56 and 58 on osX)
    – Kaiido
    Feb 6, 2017 at 2:56

0

You must log in to answer this question.

Browse other questions tagged .