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

186
Vistas
replace '_blank' in javascript window.open links with '_self'

I'm trying to make a small chrome extension that will replaces the target in javascript window.open links but not sure how to approach.

this is an example link:

<a href="javascript:void(window.open('https://www.google.com','_blank','toolbar=1,location=1,status=1,menubar=1,scrollbars=1,resizable=1'));">

Here I want to replace '_blank' with '_self' instead so all these links open in the same tab.

Edit: just noticed some of the links has __blank or _new so need to replace other variations.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

If you want to do this with all <a> tags, you can use a for loop:

for (let link of document.querySelectorAll("a")) { // Note: for/of was recently introduced
  link.href = link.href.replace("_blank", "_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