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

257
Visualizações
How to refresh a screen automatically after closing the pop up?

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="Tokyo" class="tabcontent">
    <br>
    <a href="file:///C:/xampp/htdocs/final/pop.html" class="a-tag" 
    target="popup" 
    onclick="window.open('file:///C:/xampp/htdocs/final/pop.html','popup',`width=600,height=400,top=${window.outerHeight/2 - 250},left=${window.outerWidth/2 - 300}`); return false;">
    Click to Upload Files
    </a>
    
  </div>
</body>
</html>

When I click on click to upload files, a pop up occurs.

Here is my pop up window:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="file" multiple>
</body>
</html>

I want to refresh my screen with click to upload files tag, whenever I close my pop up. How to achieve this? Thank you.

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

0

you can do this:

window.location.reload();

or you can use window.location.href, this method reload the page again. so you can do this too:

window.location.href = window.location.pathname + window.location.search + window.location.hash;
about 4 years ago · Juan Pablo Isaza Relatório

0

The OP wanted a way to identify whenever the popup has been closed before refreshing the page.

You can assign the popup to a variable and then use the window.onbeforeunload event to determine whenever the popup window is closed.

    <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="UTF-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Document</title>
    </head>
    <body>
      <div id="Tokyo" class="tabcontent">
        <br>
        <a href="file:///C:/xampp/htdocs/final/pop.html" class="a-tag" 
        target="popup" 
        onclick="onUserUpload()">
        Click to Upload Files
        </a>
        
      </div>
    </body>
    </html>

  function onUserUpload(e) {
  
  let popup = window.open(
    'file:///C:/xampp/htdocs/final/pop.html',
    'popup',
    `width=600,height=400,top=${window.outerHeight/2 - 250},left=${window.outerWidth/2 - 300}`
  );

  popup.addEventListner('beforeunload', function refreshOnClose(e) {
      //the event only fires after the popup window is closed
      if(Object.keys(e).length) {
         console.log('Popup is closed.');
         popup.removeEventListener('beforeunload', refreshOnClose);
         //reload current window
         return window.location.reload();
      }
  }
  
 })
about 4 years ago · Juan Pablo Isaza Relatório

0

window.reload()
<form onsubmit="window.reload()">
<input type="file" multiple />
</form>
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