On Mar 27, 2012, at 10:17 AM, yan shi wrote:

> when i try to do the following in a action
> render :js => "window.close();" wont work
> 
> it still response in the browser,but the window wont close.
> i dont know why.thx!

You can only close a window in JavaScript if you also opened it in JavaScript. 
So this will work on a popup window you opened, but it won't work on a window 
the user opened. Which is yours? Also, some browsers further kink this so that 
the window.close() event will only work if it was fired from a user click, not 
a JavaScript program running on its own without user interaction.

Walter

> -- 
> 愿爱与喜悦心与你同在!
> 
> 石岩敬上
> 大连东软信息学院 计算机系软件工程应用方向
> Dalian NEUSOFT Institute of Information 
> 中国-大连市软件园路8号
> 邮编:116023
> Mail:[email protected]
> Phone:15242613529
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to