iframe Fractal

MDN Web Docs say:

The <iframe> HTML element represents a nested browsing context, embedding another HTML page into the current one.

Below is an iframe with the source pointing to the Home page of this site.

<iframe src="/index.html"></iframe>

One idea that I had about this was making a fractal by nesting the iframes. The first test to do was see how nested iframes work. Would the slow do the browser, or would there be measures in place? I created a simple html file with an iframe to itself in it.

<html>
  <body>
    <iframe src="fractal.html"></iframe>
  </body>
</html>
Here is a link to the code

To better see the recursion, I wanted to make the iframes a different size. Specifically, I wanted each to be half the size of the one before.

With size reduction

Now there is a problem. The recursion is only two iframes deep, which is not allowing enough recursion for a fractal. There does not seem to be a solution to this, since the iframe specification specifies this behaviour.

Stackoverflow thread discussing this
Bug report for firefox 2 about this
Bug from 2009 still around in 2021 (May crash your browser)

I decided to see how a sierpinski triangle would look anyway.

sierpinski triangle fractal