Forum: Ruby on Rails Controller redirect_to to leave iframe

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
8ac999193268eab2f987c837953a1ec3?d=identicon&s=25 nextpulse (Guest)
on 2009-05-07 20:44
(Received via mailing list)
Inside an iframe, I want the controller to redirect_to to the parent
(i.e.  target ='_parent').
Any ideas?
(Everything I've tried- via redirect_to - just keeps it inside the
iframe)
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2009-05-07 20:47
(Received via mailing list)
On May 7, 7:43 pm, nextpulse <rob...@nextpulse.com> wrote:
> Inside an iframe, I want the controller to redirect_to to the parent
> (i.e.  target ='_parent').
> Any ideas?
> (Everything I've tried- via redirect_to - just keeps it inside the
> iframe)

i don't think you can do this server side - you need to set the right
target attribute etc on the link and so on.

Fred
1e7782e67bb34c9c67ed19d5cde5f4eb?d=identicon&s=25 Tom Z Meinlschmidt (Guest)
on 2009-05-07 20:52
(Received via mailing list)
nextpulse wrote:
> Inside an iframe, I want the controller to redirect_to to the parent
> (i.e.  target ='_parent').
> Any ideas?
> (Everything I've tried- via redirect_to - just keeps it inside the
> iframe)
>
>
use responds_to_parent plugin

tom
--
===============================================================================
Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache

www.meinlschmidt.com  www.maxwellrender.cz  www.lightgems.cz
===============================================================================
8ac999193268eab2f987c837953a1ec3?d=identicon&s=25 nextpulse (Guest)
on 2009-05-07 20:52
(Received via mailing list)
thanks.
Seems like I may have to render some JS in the controller to call the
parent.


On May 7, 11:46 am, Frederick Cheung <frederick.che...@gmail.com>
8ac999193268eab2f987c837953a1ec3?d=identicon&s=25 nextpulse (Guest)
on 2009-05-07 22:19
(Received via mailing list)
I used a quick workaround. Replace the redirect_to with:

render :text => "<html><body><script type='text/javascript'
charset='utf-8'>window.parent.document.location.href = '/myloc';</
script></body></html>"
9ac30a672001af0ee33257f92d4f0482?d=identicon&s=25 vkiyoshi (Guest)
on 2009-05-16 12:25
(Received via mailing list)
I think this works better:

<script>parent.location.href='/foo';</script>

Kiyoshi
This topic is locked and can not be replied to.