提交iframe中的内容后需要跳出iframe [英] Need to break out of iframe after content in iframe is submitted
问题描述
但是,一旦表单在iframe内被提交(我再也没有控制),它加载了一个页面,我做了控制,但在IFRAME中有该页面,而不是在该页面上突出显示iframe。我如何在该页面上跳出iframe?
我假设需要一些Javascript,但这段代码不好:
if(top.location!= self.location){
top.location = self.location;
}
使用此代码加载网站的主索引页面。我需要它在表单提交之后加载页面并将其分开。再次,我可以访问在iframe中提交表单后在iframe中加载的页面。
请帮助我。
这可能是一个棘手的方法吗?例如,当页面正在加载?或者以某种方式检查iframe是否已提交?我控制了我网站上的两个页面(最初包含iframe的页面和iframe提交到的页面),而不是iframes内容。
谢谢:)
我相信你想要这个
if(this!= top){
top.location.href = this.location.href;
$ / code>
爆发
它可能也需要文档参考...我不在计算机上检查。
if(this! = top){
top.document.location.href = this.document.location.href;
}
Ok, I am using an iframe on a page. The content within the iframe I have no control over and is being utilized with an Adobe Flash program.
But once the form is sumitted within the iframe (again which I have no control over), it loads up a PAGE, I DO HAVE CONTROL Over, but has that page within the IFRAME instead of it breaking out of the iframe on that page. How do I break out of the iframe on that page only??
I'm assuming that some Javascript is needed, but this code is no good:
if (top.location != self.location) {
top.location = self.location;
}
Using this code loads up the main index page for the site. I need it to just load the page after the form is submitted and break out of it. Again, I have access to the page that gets loaded within the iframe after the form gets submitted within the iframe.
Please help me.
Perhaps a tricky way of doing it is involved? For example while the page is being loaded? Or somehow check that the iframe has been submitted? I control both pages on my website (The page that holds the iframe originally and the page that the iframe gets submitted to), just not the iframes content.
Thanks :)
I believe you want this
if(this != top){
top.location.href = this.location.href;
}
To break out
It might need the document reference too... I'm not at a computer to check.
if(this != top){
top.document.location.href = this.document.location.href;
}
这篇关于提交iframe中的内容后需要跳出iframe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!