I have a form in my rails 3 app that is used to create new tags. This page is opened in a new window and I would like for that window to close after a successful submission of a new tag. How should I go about doing that.
I tried <%= f.submit "Create Tag", :onclick => "window.close()" %> and that didn’t work – it still followed through with the redirection.
How might I redirect to a javascript file that would close the window?
Here I tried to redirect to another html page, but it still doesn’t close when I use rails, even though it works when I just load it manually.
> <!DOCTYPE html> <html> <head>
> <meta http-equiv="Content-type" content="text/html; charset=utf-8">
> </head>
>
> <body id="sample"
> onload="window.close()">
> This page was meant to close itself immediately using javascript.
> If it has not, please close it
> manually. </body> </html>
I used the best answer on this forum and it seems to work … I’m not quite sure why.
http://www.google.com/support/forum/p/Chrome/thread?tid=23c03746e3aa03f9&hl=en