I want to display it in another tab when using link_to with Rails, so I made a note because it was implemented.
First, specify the character string you want to display with
link_to and the link destination URL.
<%= link_to "string", "link destination URL" %>
target: :_blank to display in another tab
<%= link_to "string", "link URL", target: :_blank %>
Now you can open it in another tab. However, this has problems in terms of performance and security. .. ..
- Google engineer warns that the “Open in another tab” link is actually dangerous! ? [SEO information summary]
- Actually dangerous? Dangerous “Open in another tab (target=”_blank”)”
It seems to be good to add
rel="noopener noreferrer" to avoid this problem.
<%= link_to "character string", "link destination URL", target: :_blank, rel: "noopener noreferrer" %>
Now you can open another tab with confidence.