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

191
Views
Use window object to pull content of body from child window after 3rd party authentication

I have a web app running on localhost:3000 which contains a button. When the button is clicked, a new window (child) is opened with the following code:

        let handle = window.open(
          "abc.html",
          "extension_popup",
          "width=700,height=700,status=no,scrollbars=yes,resizable=no"
        );

Inside abc.html, I've got the following:

<!doctype html>
<html>
<title>3rd Party Login</title>
<head>
</head>
<body>
      <script crossorigin src="<3rd Party SDK>.min.js"></script>    
      <script type="text/javascript" src="./<3rd party wrapper>.js"></script>    
      <script type="text/javascript" src="./abc.js"></script>
</body>
</html>

abc.js has some code which triggers a login using the 3rd party SDK. The login uses Oauth 2.0 and therefore contains redirects. Once the login is successful, an authorization code is displayed on the child window. The URL on the child window now reads the 3rd party authentication server's address and not http://localhost:3000/abc.html.

My requirement is to pull this code displayed in the child window body after the login is complete from the parent page (http://localhost:3000).

I have 2 questions:

  1. Is it possible to achieve this? I've tried using the "handle" object to do something like the following: handle.document.getByElement("title") or handle.document.getByElement("body") I've not been able to pull any information. Instead I receive this error: Uncaught DOMException: Blocked a frame with origin "http://localhost:3000" from accessing a cross-origin frame.

  2. If this is possible, how can I wait for the authentication to complete on the parent page before querying for the information present in the body?

I've seen content-scripts as part of extensions that can be used to do a chrome.runtime.sendMessage() to pass information to another window. However, content-scripts only work within the scope of extensions. Right?

I also am not able to add any code in abc.js to pass this information back to the parent window because once the authentication process begins, the page gets redirected to the 3rd party domain.

I would really appreciate any suggestions on how to get this working.

Thanks!

about 4 years ago · Juan Pablo Isaza
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!