Php 每次使用window.location时,Iframe是嵌套的
我有这个html结构: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>
<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