Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Safari 16.3 IFrame Depth Limit?

Heyas

I have a webpage with a few iFrames within iFrames

After a certain "depth" Safari no longer renders the iFrames even though developer tools can still find the children of the iFrames.


Works fine in Windows 11 with latest Edge and latest Chrome.

I tested this on a brand new Mac Mini M2 with latest OS and latest Safari.


Can anyone confirm that there is a "depth" limit to Safari 16.3 and any documentation so I can have this annotated on the history logs.

Posted on Mar 14, 2023 6:44 AM

Reply

Similar questions

2 replies

Mar 14, 2023 8:15 AM in response to HK_DEV_UK

Ah... I just wrote a test page. It works fine in Edge and Chrome but not on MacOs Safari (latest version).

Here is the code for the test page -> the timer is huge just to ensure the entire thing is properly loaded just in case


It seems that Safari stops rendering any iFrame that already has two iFrame parents.


So I'm in trouble now...

Anyone has any idea?


<html>
  <head>
    <title>iFrame Depth Testing</title>
    <script>
      const Initialise = () => {
        document.body.appendChild(CreateFrames(0, 10));
      };
      const CreateFrames = (current, max) => {
        const iFrame = document.createElement("iframe");
        iFrame.style.cssText =
          "position:absolute;left:100px;top:100px;width:1000px;height:1000px;";

        const title = "Hi! Im IFrame number:" + current;

        const testLoad = () => {
          if (iFrame.contentDocument && iFrame.contentDocument.body) {
            const div = document.createElement("hr");
            div.innerHTML = title;
            iFrame.contentDocument.body.appendChild(div);
            if (current < max) {
              iFrame.contentDocument.body.appendChild(CreateFrames(current + 1, max));
            }
          } else {
            setTimeout(testLoad, 1000);
          }
        };
        setTimeout(testLoad, 1000);
        return iFrame;
      };
    </script>
  </head>
  <body onload="Initialise();"></body>
</html>



Safari 16.3 IFrame Depth Limit?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.