Reputation: 1458
Using Rails 4..
I have opened a page using javascript like so
<%= link_to "how to choose a rating", ratingsystem_path, :onclick=>"window.open(this.href,'create_company', 'height=600, width=600');return false;" %>
But when I add a link to close that page
<%= link_to "Close page", :onclick => "window.close();" %>
It doesn't work. Am I doing this wrong? Maybe use an a tag instead?
Upvotes: 3
Views: 936
Reputation: 10251
Instead of
<%= link_to "Close page", :onclick => "window.close();" %>
Try this:
<%= link_to 'Close page', '_self', :onclick=>'window.close();' %>
You can replace '_self'
with pass nothing like ''
This works for me I hope for you the same ;)
Upvotes: 6