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! -- *愿爱与喜悦心与你同在! 石岩敬上 大连东软信息学院 计算机系软件工程应用方向 Dalian NEUSOFT Institute of Information 中国-大连市软件园路8号 邮编:116023 **Mail:hlcfan.yan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org* <hlcfan.yan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> *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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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:hlcfan.yan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
thx very much. so is there any ways to accomplish that? 在 2012年3月27日 下午11:02,Walter Lee Davis <waltd-HQgmohHLjDZWk0Htik3J/w@public.gmane.org>写道:> > 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:hlcfan.yan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- *愿爱与喜悦心与你同在! 石岩敬上 大连东软信息学院 计算机系软件工程应用方向 Dalian NEUSOFT Institute of Information 中国-大连市软件园路8号 邮编:116023 **Mail:hlcfan.yan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org* <hlcfan.yan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> *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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Mar 27, 2012, at 11:05 AM, yan shi wrote:> thx very much. so is there any ways to accomplish that?If you''re asking if the page can close the main (or any user-opened) window, the answer is no, and for good reason. The page can close itself if the window was opened programmatically, but it sounds as if you are not talking about doing that, so the answer is no. Walter> > 在 2012年3月27日 下午11:02,Walter Lee Davis <waltd-HQgmohHLjDZWk0Htik3J/w@public.gmane.org>写道: > > 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:hlcfan.yan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > > > > > -- > 愿爱与喜悦心与你同在! > > 石岩敬上 > 大连东软信息学院 计算机系软件工程应用方向 > Dalian NEUSOFT Institute of Information > 中国-大连市软件园路8号 > 邮编:116023 > Mail:hlcfan.yan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
muchas gracias 在 2012年3月27日 下午11:10,Walter Lee Davis <waltd-HQgmohHLjDZWk0Htik3J/w@public.gmane.org>写道:> > On Mar 27, 2012, at 11:05 AM, yan shi wrote: > > > thx very much. so is there any ways to accomplish that? > > If you''re asking if the page can close the main (or any user-opened) > window, the answer is no, and for good reason. The page can close itself if > the window was opened programmatically, but it sounds as if you are not > talking about doing that, so the answer is no. > > Walter > > > > > 在 2012年3月27日 下午11:02,Walter Lee Davis <waltd-HQgmohHLjDZWk0Htik3J/w@public.gmane.org>写道: > > > > 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:hlcfan.yan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > > > 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 rubyonrails-talk-/JYPxA39Uh4Ykp1iOSErHA@public.gmane.orgm > . > > > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > > > > > > > > > -- > > 愿爱与喜悦心与你同在! > > > > 石岩敬上 > > 大连东软信息学院 计算机系软件工程应用方向 > > Dalian NEUSOFT Institute of Information > > 中国-大连市软件园路8号 > > 邮编:116023 > > Mail:hlcfan.yan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- *愿爱与喜悦心与你同在! 石岩敬上 大连东软信息学院 计算机系软件工程应用方向 Dalian NEUSOFT Institute of Information 中国-大连市软件园路8号 邮编:116023 **Mail:hlcfan.yan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org* <hlcfan.yan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> *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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.