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

428
Vistas
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 Respuestas
Responde la pregunta

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 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