Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/471.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 每次使用window.location时,Iframe是嵌套的_Php_Javascript_Jquery_Html_Iframe - Fatal编程技术网

Php 每次使用window.location时,Iframe是嵌套的

Php 每次使用window.location时,Iframe是嵌套的,php,javascript,jquery,html,iframe,Php,Javascript,Jquery,Html,Iframe,我有这个html结构: <html> <body> This is the container of the iframe <iframe src="/foo.html"> </iframe> </body> </html> /foo.html <html> <script type="text/javascript"> $('a').click( function() { window.locat

我有这个html结构:

<html>
<body>
This is the container of the iframe
<iframe src="/foo.html">
</iframe>
</body>
</html>
/foo.html

<html>
<script type="text/javascript">
$('a').click( function() {
window.location = window.location;
});
</script>
<body>
<a href="#">link to me</a>
</body>
</html>
当我多次单击“链接到我”时,iframe嵌套在另一个iframe结构中,如副本,因为使用firebug可以验证这一点:

<html>
 <body>
  This is the container of the iframe
  <iframe src="/foo.html">
<html>
 <body>
  This is the container of the iframe
  <iframe src="/foo.html">
<html>
 <body>
  This is the container of the iframe
  <iframe src="/foo.html">
  </iframe>
 </body>
</html>
  </iframe>
 </body>
</html>
  </iframe>
 </body>
</html>
?我能做些什么来解决这个问题?

一个iframe是基于它可以访问的内容而受到限制的。如果您的iframe来自同一域和同一子域,则您的iframe可以使用:


或访问必要数据的其他类似方法。如果它不是来自同一个域和子域,则尝试使用上述任何代码都将导致错误。

window.location=window.location document.location.href=document.location.href
parent.document.location
parent.window.location
parent.window.document.location
parent.document.location.href