redirect_to离开iframe [英] redirect_to out of an iframe

查看:124
本文介绍了redirect_to离开iframe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个rails应用程序,它有一个在iframe中呈现的表单,并且从创建操作我希望 redirect_to 从iframe中重新呈现整个页面而不是iframe。

i have a rails app which has a form that renders in an iframe, and from the create action i would like to redirect_to out of the iframe and re-render the whole page rather than in the iframe.

我很好奇有什么想法可以实现这一点。

i was curious what ideas are out there to accomplish this.

推荐答案

你可以做到!你必须用以下代码替换redirect_to:

You can do it! you have to replace the redirect_to with:

render :text => "<script>parent.location.href='/cms';</script>"

这篇关于redirect_to离开iframe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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