为什么iframe没有加载与页面相同的url [英] Why iframe is not loaded for same url as page

查看:505
本文介绍了为什么iframe没有加载与页面相同的url的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是测试了一些东西,发现了有趣的 iframe 行为。
在页面上,我有以下 iframe

I was just testing some stuff and came across the interesting iframe behavior. On the page i have the following iframe:

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

现在,如果 src c $ c> iframe 与页面的URL (... / Wizard / Start)相同, iframe 不会加载内容,只是保持空白,并且没有错误,警告或任何报告。

Now, if the src of iframe is the same as url of the page (.../Wizard/Start), the iframe does not load the contents, just remains blank and there is no errors, warnings or anything reported.

我可以看到这是设计,在所有浏览器中都一样。

I can see that this is by design, acts the same in all browsers.

为什么?有关此行为的任何官方文档?

Why? Any official documentation on this behavior?

推荐答案

这确实是指定的行为。您的问题的答案是在这个文件中:

This is indeed the specified behaviour. The answer to your question is in this document:

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

在无限递归一节中说:


无限递归被阻止。任何尝试将SRC分配给其任何祖先使用的URL的框架都被视为根本没有
SRC URL(基本上是一个空白框架)。这并不能阻止所有的
恶意文档,但是它消除了一个麻烦的类。

Infinite recursion is prevented. Any frame that attempts to assign as its SRC a URL used by any of its ancestors is treated as if it has no SRC URL at all (basically a blank frame). This doesn't prevent all malicious documents, but it eliminates a troublesome class of them.

该文档可以追溯到1997年,但据我所知还没有被取代。

The document dates back to 1997 but hasn't been superseded yet, as far as I know.

这篇关于为什么iframe没有加载与页面相同的url的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆