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

432
Visualizações
Javascript/jquery: how to detect page loaded in other window or with applinks?

I'm integrating a new payment method in my webpage. This method use a webredirect to send the customer to the payment page.

The redirect is made using location.href=.... command, then usually my web page is unloaded and user is sent to payment site.

I have some issue when the link is somehow opened in other window or if the customer is browsing with a phone, when the link is handled by the app link and the payment app is opened. The customer completes the payment in the second window or in the mobile app and then he focus again in my webpage, but my webpage is still because for its logic, the location.href was thrown.

I know I have somehow to handle an auto-refresh when the user comes back. How can I understand if the location.href command has unload the page or if it is just opened by an application and my page is still there?

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

0

Usually 3rd party payment redirects happen on new window & is done via window.open

Caveats: User should allow the pop-ups in the browser

It gives a better control over the new Tab / Iframe opened & establish a bi-direction communication bridge to get the status and events bi-directionally through WindowProxy like closed or check referrer.

Alternatively you can hook into window.onbeforeunload and set a flag as below

example:

window.onbeforeunload = function(){
  sessionStorage.isUnloaded = 1
}

and use the flag on window.onload to deduce if you moved away / closed / duplicate session.

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