Is it possible to for a script to automatically add target=”_blank” to anchor links in Ruby on Rails.
For example, when I add a link in a blog I’d like it to automatically have _blank on every link so the link opens in a new window.
Is this possible with Javascript or Rails?
You can achieve this using JavaScript:
This code will open all the anchors with the
targetattribute set to_blank.