I have given an answer on Stack Overflow and it is working on jsfiddle plus my local machine but people are complaining that that it doesn't work (gives any output) to them.

So I tried to check it from chrome and got this error on Consol:e

Uncaught SecurityError: Failed to read the 'contentDocument' property from 'HTMLIFrameElement': Sandbox access violation: Blocked a frame at "http://stacksnippets.net" from accessing a frame at "null". Both frames are sandboxed and lack the "allow-same-origin" flag.

In IE 11 it's giving "Access is denied" error.

For reference, the link to my answer is here.


2 Answers 2


Looks like a weird jQuery bug. The iframe mentioned in this other answer is created in the jQuery "core" code itself:

 * Try to determine the default display value of an element
 * @param {String} nodeName
function defaultDisplay( nodeName ) {
    var doc = document,
        display = elemdisplay[ nodeName ];

    if ( !display ) {
        display = actualDisplay( nodeName, doc );

        // If the simple way fails, read from inside an iframe
        if ( display === "none" || !display ) {

            // Use the already-created iframe if possible
            iframe = (iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" )).appendTo( doc.documentElement );

            // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
            doc = iframe[ 0 ].contentDocument;

            // Support: IE

            display = actualDisplay( nodeName, doc );

        // Store the correct default display
        elemdisplay[ nodeName ] = display;

    return display;

(link to download jQuery unminified version)

  • whats the possible solution then?
    – A.B
    Commented Dec 15, 2014 at 10:47
  • @A.B good question, I'd say either fix jQuery to not append hidden frames, or fix Stach Exchange snippets host so it won't crash on this. (not really sure how though) Commented Dec 15, 2014 at 12:53

I have no idea where it's coming from, but there seems to be an extra <iframe> inside that snippet.

Here's what Chrome's console shows me as the HTML of the iframe:


<style id="stylish-1" class="stylish" type="text/css"></style></head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <script type="text/javascript">
    $("h1").fadeIn("slow").animate({ fontSize : '40px' });


</body><iframe frameborder="0" width="0" height="0"></iframe></html>

Again, that's really weird.

  • good notice, but i hope i can get solution for it. i dont want to make it a repost, instead if it is a bud it should be removed
    – A.B
    Commented Dec 14, 2014 at 21:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .