# How to close a window when using EJS?

**URL:** <https://www.ruby-forum.com/t/how-to-close-a-window-when-using-ejs/173828>\
**Category:** Rails\
**Created:** [August 16, 2009, 3:42am UTC](https://www.ruby-forum.com/t/how-to-close-a-window-when-using-ejs/173828 "2009-08-16T03:42:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SSSSSSSSSS\_SSSSSSSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c89c15/32.png) [@SSSSSSSSSS\_SSSSSSSS](https://www.ruby-forum.com/u/SSSSSSSSSS_SSSSSSSS)\
**Post date:** [August 16, 2009, 3:42am UTC](https://www.ruby-forum.com/t/how-to-close-a-window-when-using-ejs/173828/1 "2009-08-16T03:42:40Z")

</div>

when using EJS,I have to write in the controller like this:  
…  
Render :update do |page|  
Page.xxxxx  
End  
…  
I want to know if there is a method “xxxxx” to close the current  
window,if  
not ,how can I close the current window with EJS?  
Thanks

---

<div class="post-metadata">

**Author:** ![SSSSSSSSSS\_SSSSSSSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c89c15/32.png) [@SSSSSSSSSS\_SSSSSSSS](https://www.ruby-forum.com/u/SSSSSSSSSS_SSSSSSSS)\
**Post date:** [August 16, 2009, 3:45am UTC](https://www.ruby-forum.com/t/how-to-close-a-window-when-using-ejs/173828/2 "2009-08-16T03:45:00Z")

</div>

Sorry…a mistake,I was saying “…close the current window without  
EJS”

2009 å¹´ 8 16 æ—¥ 9:41 AMåœ¨ “åˆ˜å­å˜‰” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) æåˆ°ï¼š

when using EJS,I have to write in the controller like this:  
…  
Render :update do |page|  
Page.xxxxx  
End  
…  
I want to know if there is a method “xxxxx” to close the current  
window,if  
not ,how can I close the current window with EJS?  
Thanks

---

<div class="post-metadata">

**Author:** ![SSSSSSSSSS\_SSSSSSSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c89c15/32.png) [@SSSSSSSSSS\_SSSSSSSS](https://www.ruby-forum.com/u/SSSSSSSSSS_SSSSSSSS)\
**Post date:** [August 16, 2009, 10:14am UTC](https://www.ruby-forum.com/t/how-to-close-a-window-when-using-ejs/173828/3 "2009-08-16T10:14:48Z")

</div>

On Aug 16, 2:43 am, Áõ×Ó¼Î [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I want to know if there is a method “xxxxx” to close the current window,if  
> not ,how can I close the current window with EJS?

You can use \<\< to execute arbitrary javascript.

Fred
