How to close the window in Rails?
I have the following link in my view that opens a changelog in a new page:
<%= link_to("Changelog", changelog_path, :target => "_blank") %>
In this changelog page I would like to create a link to close this changelog p开发者_如何转开发age.
What is the most appropriate way to do this ?
Is that possible to achieve this without Javascript ?
You will need to use JavaScript for this. You can call window.close()
, but this will prompt the user before closing the window, unless the window was opened from JavaScript with window.open()
, so you will also need to use JavaScript for opening the window instead of a link with target="_blank"
.
精彩评论