开发者

How to close the window in Rails?

开发者 https://www.devze.com 2023-03-03 22:51 出处:网络
I have the following link in my view that opens a changelog in a new page: <%= link_to(\"Changelog\", changelog_path, :target => \"_blank\") %>

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".

0

精彩评论

暂无评论...
验证码 换一张
取 消