Abrir enlace en nueva pestaña o ventana [duplicar]


Esta pregunta ya tiene una respuesta aquí:

¿Es posible abrir un enlace a href en una nueva pestaña en lugar de la misma pestaña?

<a href="http://your_url_here.html">Link</a>
Author: wvdz, 2013-03-21

4 answers

Debe agregar target="_blank" y rel="noopener noreferrer" en la etiqueta de anclaje.

Por ejemplo:

<a target="_blank" rel="noopener noreferrer" href="http://your_url_here.html">Link</a>

Fuente:

 1537
Author: Nathan,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-08-14 06:48:40

No debe ser tu llamada decidir si el enlace debe abrirse en una nueva pestaña o en una nueva ventana, ya que en última instancia esta elección debe hacerse por la configuración del navegador del usuario. A algunas personas les gustan las pestañas; a otras les gustan las ventanas nuevas.

Usando _blankle indicará al navegador que use una nueva pestaña/ventana, dependiendo de la configuración del navegador del usuario y cómo haga clic en el enlace (por ejemplo, clic medio, Ctrl+clic, o clic normal).

 202
Author: Gauthier Roebroeck,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-11-13 00:41:59

Establece el atributo target de tu elemento <a> en "_tab"

EDITAR: Funciona, sin embargo W3Schools dice que no hay tal atributo de destino: http://www.w3schools.com/tags/att_a_target.asp

EDIT2: Por lo que he averiguado de los comentarios. establecer destino en _blank le llevará a una nueva pestaña o ventana (dependiendo de la configuración de su navegador). Escribir cualquier cosa excepto una de las siguientes creará un nuevo grupo de pestañas (no estoy seguro de cómo funcionan):

_blank  Opens the linked document in a new window or tab
_self   Opens the linked document in the same frame as it was clicked (this is default)
_parent Opens the linked document in the parent frame
_top    Opens the linked document in the full body of the window
framename   Opens the linked document in a named frame
 39
Author: Toon Casteele,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-03-21 15:55:14

Simplemente puede hacerlo configurando target="_blank", w3schools tiene un ejemplo.

 26
Author: Ehsan,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-02-26 15:03:05