# How to close a popup?

**URL:** <https://www.ruby-forum.com/t/how-to-close-a-popup/90114>\
**Category:** Rails\
**Created:** [March 26, 2007, 5:36am UTC](https://www.ruby-forum.com/t/how-to-close-a-popup/90114 "2007-03-26T05:36:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![patcito](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/50afbb/32.png) [@patcito](https://www.ruby-forum.com/u/patcito)\
**Post date:** [March 26, 2007, 5:36am UTC](https://www.ruby-forum.com/t/how-to-close-a-popup/90114/1 "2007-03-26T05:36:48Z")

</div>

hey all,  
I open a popup from a firefox extension with window.open(myurl).  
The content of the popup is a regular form with a text\_field to fill.  
Is there a way to automatically close the popup after the user click  
the form’s submit button?

thanx in advance

Pat

---

<div class="post-metadata">

**Author:** ![patcito](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/50afbb/32.png) [@patcito](https://www.ruby-forum.com/u/patcito)\
**Post date:** [March 26, 2007, 5:57am UTC](https://www.ruby-forum.com/t/how-to-close-a-popup/90114/2 "2007-03-26T05:57:08Z")

</div>

window.close(); ?

I personally use a button type input and add an onclick handler to do  
stuff. If the form looks good I then do a document.forms[0].submit()  
and then window.close().

Hope this helps!

Shawn

Patrick A. wrote:

> hey all,  
> I open a popup from a firefox extension with window.open(myurl).  
> The content of the popup is a regular form with a text\_field to fill.  
> Is there a way to automatically close the popup after the user click  
> the form’s submit button?
> 
> thanx in advance
> 
> Pat
