Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

184
Vistas
Block target="_blank" popup with Javascript

I would like to know if it is possible to block the opening of a new window from a certain element in Javascript

I tried that but it doesn't work:


var links= document.getElementsByTagName('a');
for (var i=0; i<links.length; i++){
    links[i].setAttribute('target', '_top');
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Per W3Schools, the default target is "_self". Try the following:

var links= document.getElementsByTagName('a');
for (curLink of links){
    curLink.setAttribute('target', '_self');
}
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda