# Disabling a layout before calling javascript window.open

**URL:** <https://www.ruby-forum.com/t/disabling-a-layout-before-calling-javascript-window-open/97554>\
**Category:** Rails\
**Created:** [July 7, 2006, 9:24pm UTC](https://www.ruby-forum.com/t/disabling-a-layout-before-calling-javascript-window-open/97554 "2006-07-07T21:24:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![seamus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/2bfe46/32.png) [@seamus](https://www.ruby-forum.com/u/seamus)\
**Post date:** [July 7, 2006, 9:24pm UTC](https://www.ruby-forum.com/t/disabling-a-layout-before-calling-javascript-window-open/97554/1 "2006-07-07T21:24:02Z")

</div>

Hi,

I have some code in which i open a pop up when a user clicks on a link.  
However, the new popup window comes with the layout of the page on which  
the user clicked the link. I would like to remove the layout only from  
the new window which is created with the javascript window.open - any  
ideas

thanks

---

<div class="post-metadata">

**Author:** ![seamus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/2bfe46/32.png) [@seamus](https://www.ruby-forum.com/u/seamus)\
**Post date:** [July 7, 2006, 9:36pm UTC](https://www.ruby-forum.com/t/disabling-a-layout-before-calling-javascript-window-open/97554/2 "2006-07-07T21:36:43Z")

</div>

I’f you’ve already got a render, redirect\_to, or render\_partial in the  
method generating the page for the popup, just add “:layout =\> false” to  
it’s list of arguments. Otherwise, maybe try the following as the last  
line of your popup action method.

render :layout =\> false

---

<div class="post-metadata">

**Author:** ![seamus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/2bfe46/32.png) [@seamus](https://www.ruby-forum.com/u/seamus)\
**Post date:** [July 11, 2006, 5:40am UTC](https://www.ruby-forum.com/t/disabling-a-layout-before-calling-javascript-window-open/97554/3 "2006-07-11T05:40:25Z")

</div>

Jonathan M. wrote:

> I’f you’ve already got a render, redirect\_to, or render\_partial in the  
> method generating the page for the popup, just add “:layout =\> false” to  
> it’s list of arguments. Otherwise, maybe try the following as the last  
> line of your popup action method.
> 
> render :layout =\> false

Jonathan,

thanks for the suggestion but i have not had any success with it. The  
javascript to open the window is in the layout and not in a particular  
controller. The controller (question\_controller.rb, method new\_question)  
brings up a layout with a paragraph of text (view new\_question.rhtml),  
and when someone clicks on a hyperlink in the text that is presented  
with this layout, it pops up a smaller window that has the same layout.  
THis is the layout I want to get rid of but i have tried putting the  
render :layout =\> false in the code at various places with no success.  
If I put it in the layout file, i lose the layout completely and the  
pop-up does not seem to open the new window.

thanks for any advice or suggestions

seamus
