从iframe重定向到主窗口

时间:2021-10-26 23:14:36

I have an iframe wich when you press a button goes to the main page

当你按下按钮进入主页面时,我有一个iframe

self.redirect('/')

but the problem is that the content of the main page is shown inside the iframe, and I want to show it in the main window (not in the iframe)

但问题是主页面的内容显示在iframe中,我想在主窗口中显示(而不是在iframe中)

How can we get that?

我们怎么能这样做?

1 个解决方案

#1


0  

If I understand your question. You like to redirect to your mainpage and remove the iframe. In your iframe You have to use a button to initiate a redirect and some javascript:

如果我理解你的问题。您想重定向到您的主页并删除iframe。在您的iframe中您必须使用按钮来启动重定向和一些javascript:

<input value="ReDirect" id="button" onclick="parent.parent.location.href ='... url ....';">

See also this question : How to dynamically close an iframe after form submit in JavaScript

另请参阅此问题:如何在JavaScript中提交表单后动态关闭iframe

#1


0  

If I understand your question. You like to redirect to your mainpage and remove the iframe. In your iframe You have to use a button to initiate a redirect and some javascript:

如果我理解你的问题。您想重定向到您的主页并删除iframe。在您的iframe中您必须使用按钮来启动重定向和一些javascript:

<input value="ReDirect" id="button" onclick="parent.parent.location.href ='... url ....';">

See also this question : How to dynamically close an iframe after form submit in JavaScript

另请参阅此问题:如何在JavaScript中提交表单后动态关闭iframe