Why the iframe does not load for the same url as the page

I just tested some things and came across interesting iframe behavior. On the page, I have an iframe :

 <iframe src="/Wizard/Start"></iframe> 

Now, if src of iframe matches the URL of the page (.../Wizard/Start) , iframe does not load the content, it just remains empty and there are no errors, warnings or anything else was not reported.

I see that this is by design, it works the same in all browsers.

Why? Any official documentation of this behavior?

+6
source share
2 answers

This is really a given behavior. The answer to your question is given in this document:

http://www.w3.org/TR/WD-frames-970331

The Endless Recursion section says:

Infinite recursion is prevented. Any frame that tries to designate as its SRC the URL used by any of its ancestors is treated as if it does not have an SRC URL at all (basically an empty frame). This does not interfere with malicious documents, but it eliminates their difficult class.

The document dates from 1997, but has not yet been replaced, as far as I know.

+9
source

you mean that you load the iframe on the abc page of the abc page

 _____________________ | | | IFrame | ---------------------| | | | Page | | | _____________________ 

and here iframe again points to the same page correctly? see that it will not work as it becomes an infinite loop.

you are trying to load the same page in an iframe .. means that the contents of the iframe again contain another iframe, which again points to the same page that again has the iframe .. so it will be an infinite loop and therefore it won’t work ..

on the "xyz" page you can enable the iframe "abc" , this will not be a problem

+1
source

All Articles