Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

87
Visualizações
Replacing a tab with a different one using JS

Currently, I have something in place that opens a new tab with some html code, using

    const winUrl = URL.createObjectURL(new Blob([final_file], { type: "text/html;charset=utf8" }));
    const win = window.open(winUrl);

where final_file is some html that I generate. I want to make it so instead of opening a new tab every time, if such a tab is already open, it should replace it. I tried using frame names in window.open, but I was told that they are deprecated and shouldn't be used. What do I do?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You should place dedicated window name (target as second argument to .open) to your opened window, so browser would know to replace it instead of opening new window:

    const winUrl = URL.createObjectURL(new Blob([final_file], { type: "text/html;charset=utf8" }));
    const win = window.open(winUrl, 'my-window');

target is not deprecated.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda