[RUBY] [Rails] I want to display the link destination of link_to in a separate tab

When using link_to in Rails, I wanted to display it in a separate tab, so I implemented it, so I will leave it as a memo.

procedure

First, specify the character string to be displayed and the link destination URL with link_to.

<%= link_to "String", "Link URL" %>

Added target:: _ blank to display in a separate 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, "Open in another tab" link is actually dangerous! ?? [Summary of SEO information] -Is it really dangerous? Dangerous "Open in another tab (target =" _ blank ")"

To avoid this problem, add rel =" noopener noreferrer ".

<%= link_to "String", "Link URL", target: :_blank, rel: "noopener noreferrer" %>

Now you can open another tab with confidence.

Recommended Posts

[Rails] I want to display the link destination of link_to in a separate tab
[Rails] I want to send data of different models in a form
I want to use a little icon in Rails
I want to display the name of the poster of the comment
I want to define a function in Rails Console
I want to expand the clickable part of the link_to method
I want to create a form to select the [Rails] category
I want to narrow down the display of docker ps
I want to control the display of the upper management navigation bar (Control menu) in Liferay 7 / DXP
I want to display the images under assets/images in the production environment
I want to change the value of Attribute in Selenium of Ruby
I want to display the number of orders for today using datetime.
[Ruby] I want to display posted items in order of newest date
I want to display a PDF in Chinese (Korean) with thin reports
I want to display an error message when registering in the database
Change the save destination of the image to S3 in the Rails app. Part 2
I tried to organize the session in Rails
I want to var_dump the contents of the intent
I want to get the value in Ruby
[Rails + Webpacker] I want to use images of assets! Until you can view the image in Vue.js
[Ruby on Rails] How to make the link destination part of the specified id
Rails6 I want to make an array of values with a check box
How to make a unique combination of data in the rails intermediate table
I want to separate the handling of call results according to the API caller (call trigger)
I want to recursively get the superclass and interface of a certain class
I want to embed any TraceId in the log
I want to know the answer of the rock-paper-scissors app
I summarized the display format of the JSON response of Rails
I want to click a GoogleMap pin in RSpec
I want to be aware of the contents of variables!
I want to return the scroll position of UITableView!
[Rails] How to display an image in the view
I want to add a delete function to the comment function
[Ruby] I want to make a program that displays today's day of the week!
Rails The concept of view componentization of Rails that I want to convey to those who want to quit
[Active Admin] I want to specify the scope of the collection to be displayed in select_box
[Rails] How to display the weather forecast of the registered address in Japanese using OpenWeatherMap
Even if I want to convert the contents of a data object to JSON in Java, there is a circular reference ...
I want to find the MD5 checksum of a file in Java and get the result as a string in hexadecimal notation.
I want to find a relative path in a situation using Path
I want to set the conditions to be displayed in collection_check_boxes
I want to make a specific model of ActiveRecord ReadOnly
I want to change the log output settings of UtilLoggingJdbcLogger
I want to call a method and count the number
A story I was addicted to in Rails validation settings
[Rails] I want to display "XX minutes ago" using created_at!
How to display a graph in Ruby on Rails (LazyHighChart)
Even in Java, I want to output true with a == 1 && a == 2 && a == 3
I want to give a class name to the select attribute
I want to create a Parquet file even in Ruby
[Rails] How to display the list of posts by category
I tried to make a client of RESAS-API in Java
[Rails] Where to be careful in the description of validation
I want to transition to the same screen in the saved state
I want to use FireBase to display a timeline like Twitter
[Ruby] I want to reverse the order of the hash table
I want to temporarily disable the swipe gesture of UIPageViewController
[Rails] How to display information stored in the database in view
I want to simplify the conditional if-else statement in Java
When I switched to IntelliJ, I got a lot of differences in the encoding of the properties file.
After posting an article with Rails Simple Calendar, I want to reflect it in the calendar.