the parent window can only be accessed using the parent variable. The following modification to opener1 function should make this possible

function opener1(){
    try{
        if(parent.window.opener != null && !parent.window.opener.closed)
        {
          parent.window.opener.test1();
        }

    }catch(e){ alert(e.description);}       
}
Answer from anurupr on Stack Overflow
Discussions

Issue with Chrome 108 and window opener.
I corrected this. Because my target was _blank I had to add an additional property rel = "opener" to my tag. I saw the information here: https://developer.mozilla.org/en-US/docs/Web/API/Window/opener Not sure why or when this changed but it worked prior to Chrome 108. More on reddit.com
🌐 r/chrome
1
2
January 16, 2022
window.opener is null on android chrome (but not in incognito)
This works flawlessly on desktop as well as ios, but android chrome tells me window.opener is null, meaning the callback is never reached. More on stackoverflow.com
🌐 stackoverflow.com
July 5, 2018
window.opener is null in firefox - javascript
For example, if you open a page of site2.com from a page of site1.com the target window has it's opener null. More on stackoverflow.com
🌐 stackoverflow.com
c# - JavaScript window.open returns null sometimes - Stack Overflow
I just ran into this and it seems ... the code, in Chrome dev tools. This was extremely hit-and-miss and seemed to fail (return null, not open a window, whether one already existed or not) more times that it succeeded. I read @Joshua's comment that the creation is done asynchronously, ... More on stackoverflow.com
🌐 stackoverflow.com
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › API › Window › opener
Window: opener property - Web APIs | MDN
April 10, 2025 - A Window-like object referring to the window that opened the current window (using window.open(), or by a link with target attribute set). If this window was not opened by being linked to or created by another, returns null. If the opener is not on the same origin as the current page, functionality ...
🌐
Mozilla Bugzilla
bugzilla.mozilla.org › show_bug.cgi
1248292 - [e10s] window.opener is null if a popup window opened from an iframe inside chrome
If they open new windows with extension URLs, those will generally run in the extension process, which means that they can't directly access their opener window. We could change that, but it would result in those windows only having access to a restricted set of APIs, which is not what most people want. The probably works in Chrome because Chrome now runs extension <iframe>s in the extension process, even when they're children of content pages.
🌐
Google Groups
groups.google.com › g › comp.lang.javascript › c › k5ZsfKVzLMA
window.opener in Chrome
I have this script that works in FF and IE, but not in Chrome. I've narrowed the problem down to this: 1. A script in the main window creates a global variable by declaring it outside of any function 2. The variable is given a value MyVar = getElementById("MyId") 2. The script opens a popup window 3.
Find elsewhere
🌐
Stack Overflow
stackoverflow.com › questions › 51180645 › window-opener-is-null-on-android-chrome-but-not-in-incognito
window.opener is null on android chrome (but not in incognito)
July 5, 2018 - This works flawlessly on desktop as well as ios, but android chrome tells me window.opener is null, meaning the callback is never reached.
🌐
Chromium
bugs.chromium.org › p › chromium › issues › detail
92669 - window.opener is null when window with external ...
April 5, 2013 - About Monorail User Guide Release Notes Feedback on Monorail Terms Privacy
🌐
GitHub
github.com › whatwg › html › issues › 2636
Sort out window.opener behavior when a window.open with target targets an existing window · Issue #2636 · whatwg/html
Per spec, unless pages set window.opener it should only return non-null for auxiliary browsing contexts and should be immutable on auxiliary browsing contexts. Here are some testcases for what brow...
🌐
W3cubDocs
docs.w3cub.com › dom › window › opener
Window.opener - Web APIs - W3cubDocs
However, navigation of the opener window is possible, which means that the opened page can open a URL in the original tab or window. In some cases, this makes phishing attacks possible, where a trusted page that is opened in the original window is replaced by a phishing page by the newly opened page. In the following cases, the browser does not populate window.opener, but leaves it null:
🌐
Stack Overflow
stackoverflow.com › questions › 67082788 › window-opener-returns-null-in-chrome-version-88
window.opener returns null in chrome version >88
April 13, 2021 - From googling, We learnt that it's a security fix introduced by google - window.opener is getting assigned with null and preventing pop-up accessing parent window.
🌐
Stack Overflow
stackoverflow.com › questions › tagged › window.opener
Newest 'window.opener' Questions - Stack Overflow
when i open child window and search something in search box and when see the 'child.closed' status giving different results in Firefox and Chrome. Please help to get the same status in both browsers. ... ... Can someone please help in resolving these TypeScript errors. The test runs fine but TypeScript complains in the IDE. I appear to get two TypeScript errors. test('a test', () => { Object.... ... I just learned about the rel="noopener" attribute, which makes the opened windows unaware of their opener. I played with it a bit and got window.opener === null all the time, until I found ...
🌐
Reddit
reddit.com › r/learnjavascript › why does window.opener become null when using google oauth in a popup window, and how can i communicate the access token back to the parent window?
r/learnjavascript on Reddit: Why does window.opener become null when using Google OAuth in a popup window, and how can I communicate the access token back to the parent window?
September 10, 2023 -

I'm working with Google OAuth in my React application, and I'm implementing it through a popup. I'm using Passport with my custom backend. The initial URL that I supply to the popup window is the backend entry point that initializes the OAuth process. Google then sends a response to my callback on my backend.

After that, I need to communicate the JWT access token back that I generate on the backend to my frontend. I'm doing this by redirecting respondign with a redirect to a frontend route, with the access token as a query parameter in the redirect URL. The problem I'm facing, however, is that the window.opener in the popup becomes null after the Google OAuth process. This prevents me from sending the access token back to the parent window using window.opener.postMessage.

I have verified that the window.opener is not null when I pass in the same route my backend redirects my frontend to, as the initial url to the popup. The issue occurs when I pass in my backend endpoint for initializing google OAUTH (so it redirects to Googles sign in).

Unfortunately, I can't use cookies or localStorage due to my application's restrictions.

Has anyone faced a similar issue? Any advice or guidance would be greatly appreciated. Thanks!