href _blank with same link code example

Example 1: html open things in new tab

<a href="/" target="_blank">The home page will open in another tab.</a>

Example 2: window.location.href target blank

<script type="text/javascript">
$("#site").on('click', function(){
    window.open("http://www.someone.com/","_blank");
});
</script>

Example 3: link_to target blank

link_to(body, url, html_options = {})
  # url is a String; you can use URL helpers like
  # posts_path

link_to(body, url_options = {}, html_options = {})
  # url_options, except :method, is passed to url_for

link_to(options = {}, html_options = {}) do
  # name
end

link_to(url, html_options = {}) do
  # name
end

Tags:

Html Example