Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

435
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!