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.
nextpulse (Guest)
on 2009-05-07 22: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)
Frederick C. (Guest)
on 2009-05-07 22:47
(Received via mailing list)
On May 7, 7:43 pm, nextpulse <removed_email_address@domain.invalid> 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
Tom Z Meinlschmidt (Guest)
on 2009-05-07 22: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
===============================================================================
nextpulse (Guest)
on 2009-05-07 22: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 C. <removed_email_address@domain.invalid>
nextpulse (Guest)
on 2009-05-08 00: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>"
vkiyoshi (Guest)
on 2009-05-16 14: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.