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@gmail.com* <hlcfan.yan@gmail.com>
*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@googlegroups.com.
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.

Search Discussions

  • Walter Lee Davis at Mar 27, 2012 at 3:02 pm

    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@gmail.com
    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@googlegroups.com.
    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@googlegroups.com.
    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.
  • Yan shi at Mar 27, 2012 at 3:06 pm
    thx very much. so is there any ways to accomplish that?

    在 2012年3月27日 下午11:02,Walter Lee Davis <waltd@wdstudio.com>写道:
    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@gmail.com
    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@googlegroups.com.
    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@googlegroups.com.
    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@gmail.com* <hlcfan.yan@gmail.com>
    *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@googlegroups.com.
    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.
  • Walter Lee Davis at Mar 27, 2012 at 3:10 pm

    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@wdstudio.com>写道:
    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@gmail.com
    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@googlegroups.com.
    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@googlegroups.com.
    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@gmail.com
    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@googlegroups.com.
    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@googlegroups.com.
    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.
  • Yan shi at Mar 27, 2012 at 3:13 pm
    muchas gracias

    在 2012年3月27日 下午11:10,Walter Lee Davis <waltd@wdstudio.com>写道:
    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@wdstudio.com>写道:
    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@gmail.com
    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@googlegroups.com
    .
    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@googlegroups.com.
    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@gmail.com
    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@googlegroups.com.
    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@googlegroups.com.
    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@gmail.com* <hlcfan.yan@gmail.com>
    *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@googlegroups.com.
    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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedMar 27, '12 at 2:18p
activeMar 27, '12 at 3:13p
posts5
users2
websiterubyonrails.org
irc#RubyOnRails

2 users in discussion

Yan shi: 3 posts Walter Lee Davis: 2 posts

People

Translate

site design / logo © 2022 Grokbase