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

259
Visualizações
Reload new url using js

I am opening a file on the new tab using window.open('filepath'). i want to reload the new url once it is opened.how can i achieve this? I tried the below code but the new url is not reloading once it is opened.

var newurl = window.open('filepath','_blank');
window.location.reload();
        or
window.location.reload(newurl);

edited: Actually i am opening the content of the xml file on new url. when the file is opened on new tab it contains the previous data not the updated content. it is showing the updated content only upon reloading. The updated content will be shown on my local even if i do not reload the page but in some other site.It is not working without reloading.

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

0

let say you want to open google.com,like this

For FireFox

let tab=window.open("https://www.google.com","_blank") now to reload it you need to do something like this

tab.self.location.replace("https://www.google.com")

this will cause tab to reload the url,hope this will help

For chrome

with chrome it will only work if the script try to open the same origin URL,i.e both tab have same origin

tab.location.reload()

about 4 years ago · Juan Pablo Isaza Relatório

0

You access the window of the opened window given you don't violate CORS

const newurl = window.open('filepath', '_blank');
if (newurl) { // check if null, FireFox returns null
    newurl.location.reload();
}
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