Aaron Aaron - 4 months ago 14
HTML Question

Rails: Open link in a new page

I was wondering a way to open a link in a new tab. Here is the code I have so far:

<li><%= link_to "Pictures", pictures_path %></li>


I have researched ways to do this with
target="_blank"
, but for some reason when I tried it, it did not work. Any help is greatly appreciated!

gen gen
Answer

Try it like this:

<li><%= link_to "Pictures", pictures_path, target: :_blank %></li>
Comments