# A quick question on popup windows

**URL:** <https://www.ruby-forum.com/t/a-quick-question-on-popup-windows/65747>\
**Category:** Rails\
**Created:** [February 11, 2006, 7:40am UTC](https://www.ruby-forum.com/t/a-quick-question-on-popup-windows/65747 "2006-02-11T07:40:58Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![soderic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/8baadc/32.png) [@soderic](https://www.ruby-forum.com/u/soderic)\
**Post date:** [February 11, 2006, 7:40am UTC](https://www.ruby-forum.com/t/a-quick-question-on-popup-windows/65747/1 "2006-02-11T07:40:58Z")

</div>

How the hell do you close em off after the action is completed?  
Ta,  
Eric

---

<div class="post-metadata">

**Author:** ![soderic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/8baadc/32.png) [@soderic](https://www.ruby-forum.com/u/soderic)\
**Post date:** [February 12, 2006, 3:58am UTC](https://www.ruby-forum.com/t/a-quick-question-on-popup-windows/65747/2 "2006-02-12T03:58:20Z")

</div>

I’m curious as to how to close a browser window opened as

\<%= link\_to(image\_tag(“new\_organisation.png”, :alt =\> ‘New’, :border =\>  
1), { :controller =\> ‘to\_dos’, :action =\> ‘to\_do\_pop\_up’}, :popup =\>  
[‘new\_window’, ‘height=500,width=800’])

which performs exactly as desired within the controller on submit

And my question is =\>

after the record is processed…

flash[:notice] = ‘Note was successfully created.’  
if !(params[‘id’] == nil)  
redirect\_to :action =\> ‘job\_dashboard’, :id =\> @job  
else  
render WHAT??? \<— THIS LINE NEEDS TO CLOSE THE POP\_UP  
end

---

<div class="post-metadata">

**Author:** ![soderic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/8baadc/32.png) [@soderic](https://www.ruby-forum.com/u/soderic)\
**Post date:** [February 12, 2006, 4:07am UTC](https://www.ruby-forum.com/t/a-quick-question-on-popup-windows/65747/3 "2006-02-12T04:07:29Z")

</div>

Eric S. wrote:

> ```
> render WHAT??? <--- THIS LINE NEEDS TO CLOSE THE POP_UP
> 
> ```
> 
> end

render :text =\> “”

---

<div class="post-metadata">

**Author:** ![soderic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/8baadc/32.png) [@soderic](https://www.ruby-forum.com/u/soderic)\
**Post date:** [February 12, 2006, 6:07am UTC](https://www.ruby-forum.com/t/a-quick-question-on-popup-windows/65747/4 "2006-02-12T06:07:47Z")

</div>

Thanks Jim - that was exactly what I needed. I figured there had to be  
some render method to do that - I’d never have figured render :text tho.  
Thanks again.  
Cheers,  
Eric.

---

<div class="post-metadata">

**Author:** ![soderic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/8baadc/32.png) [@soderic](https://www.ruby-forum.com/u/soderic)\
**Post date:** [February 12, 2006, 5:33pm UTC](https://www.ruby-forum.com/t/a-quick-question-on-popup-windows/65747/5 "2006-02-12T17:33:47Z")

</div>

Eric S. wrote:

> Thanks Jim - that was exactly what I needed. I figured there had to be  
> some render method to do that - I’d never have figured render :text tho.  
> Thanks again.  
> Cheers,  
> Eric.

Well, the render :text =\> “string” just renders the plain text,  
or sting - which happens to be a bit of JavaScript. If a user has  
JavaScript disabled in the browser, it won’t work.

---

<div class="post-metadata">

**Author:** ![soderic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/8baadc/32.png) [@soderic](https://www.ruby-forum.com/u/soderic)\
**Post date:** [February 12, 2006, 10:50pm UTC](https://www.ruby-forum.com/t/a-quick-question-on-popup-windows/65747/6 "2006-02-12T22:50:36Z")

</div>

Can’t… The only way to control a user’s browser is with javascript.  
Welcome to the  
wonderful world of web programming!

b

---

<div class="post-metadata">

**Author:** ![soderic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/8baadc/32.png) [@soderic](https://www.ruby-forum.com/u/soderic)\
**Post date:** [February 12, 2006, 10:22pm UTC](https://www.ruby-forum.com/t/a-quick-question-on-popup-windows/65747/7 "2006-02-12T22:22:49Z")

</div>

Well, in my current case, I have control over whether JS is enabled - so  
that’s OK. But out of interest how would we close the window otherwise?

---

<div class="post-metadata">

**Author:** ![soderic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/8baadc/32.png) [@soderic](https://www.ruby-forum.com/u/soderic)\
**Post date:** [February 13, 2006, 2:05am UTC](https://www.ruby-forum.com/t/a-quick-question-on-popup-windows/65747/8 "2006-02-13T02:05:43Z")

</div>

Bugger!  
Thanks Guys
