Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4593788
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T22:44:05+00:00 2026-05-21T22:44:05+00:00

In order to play around a bit with frame hierarchy I wrote a small

  • 0

In order to play around a bit with frame hierarchy I wrote a small html page which allows nesting an arbitrary number of frames (code available at the end of the question).

However this doesn’t work, on IE9 and Firefox 4 the inner frames are created but aren’t rendered (the head and body are empty):

frames screenshot

and on Chrome it works for two levels and then if I click the Add button on the inner frame nothing happens (no error message in the console either).

If I copy the file N times and have each file use a different file it works for any depth (but not if there’s a cycle).

I tried to search for such a limitation but I must not have used the right keywords. Does anyone have any reference for this?

Here’s the addRemoveFrames.html file:

<!DOCTYPE html>
    <html>
    <head>
        <title>Add and Remove Frames</title>
        <script type="text/javascript">
            function add() {
                var f = document.createElement('iframe');
                f.src = 'addRemoveFrames.html';
                document.getElementById('frameContainer').appendChild(f);
            }
            function remove() {
                var c = document.getElementById('frameContainer');
                var f = c.lastChild;
                if (f)
                    c.removeChild(f);
            }
        </script>
    </head>
        <body>
            <input type="button" onclick="add()" value="Add"/>
            <input type="button" onclick="remove()" value="Remove"/>
            <hr />
            <div id="frameContainer"></div>

        </body>
    </html>

I’ve modified @davin‘s answer slightly so each frame’s URL reflects its full path in the hierarchy.

var counter = 0;
function add() {
    var f = document.createElement('iframe');
    var sep = location.search ? (location.search + '.') : "?";
    f.src = 'addRemoveFrames.html' + sep + ++counter;
    document.getElementById('frameContainer').appendChild(f);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T22:44:05+00:00Added an answer on May 21, 2026 at 10:44 pm

    Looks like a sensible browser security mechanism to prevent an infinite loop of nested iframes (even though in your case it wouldn’t be infinite).

    In any case, a simple workaround could be to add a useless query parameter to the url, making the browser think the page loaded isn’t identical, but really it is.

    So instead of your current function add(), something like this (I went all out so id doesn’t polute the global namespace):

    var add = (function(){
    
      var id = 0;
      return function(){
         var f = document.createElement('iframe');
         f.src = 'addRemoveFrames.html?useless=' + id++;
         document.getElementById('frameContainer').appendChild(f);
      };
    
    })();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've downloaded and built clang version 3.0 in order to play around a bit
I'm using play framework 1.2.4 and i'm preparing an meal order system. So i
I'm having some trouble getting my Core Data entities to play nice and order
I am trying play around with jqGrid (and a few others). Doing the initial
I'm trying to play around with the Google ngrams dataset using Amazon's Elastic Map
I'm starting to play around with Boomerang for measuring performance. It's very promising. While
In order to play videos (Flash Format) on the website I use JW Player
I am working on a small Tower Defense game in order to learn Qt.
Background: I have an application which plays video files from disc. When I play
I've been starting to play around with Node.js recently and I've come across a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.