none
window.open() returns null

    Question

  • Greetings,

    I have encountered a bug in the Edge browser's Javascript implementation of window.open().  When the 'open' function is called, there should be an object returned that is the newly opened window, but returns null.  

    The window opens, but the whole screen, and the window.opener parameter in it is null.

     openNewWin: function (url, onCloseHandler) {
                var wnd = window.open(url, "new", "width=800,height=600,resizable=yes,toolbar=no,location=no,menubar=no,status=no,directories");
            },
    
        loginSocial: function (pLoginType) {
    APP.openNewWin('https://accounts.google.com/o/oauth2/auth?redirect_uri=' + CONFIG.url + '/auth_google.html&response_type=code&client_id=' + CONFIG.googleClientId + '&scope=https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile');
            },


    You can check here:

    https://littlebigsnake.com/ 

    Do you have any information about this bug, and when or if a fix for it might be available?

    Monday, February 5, 2018 5:43 PM

All replies

  • Why do you say it is an error? Please show us the authoritive documentation specifying that the results you are getting is different from what you should get. Please be specific about what you are getting and what you are supposed to get as specified by the documentation. The probable explanation is that there is a misunderstanding of the documentation so it is critical that you be clear and specific about the problem.


    Sam Hobbs
    SimpleSamples.Info

    Monday, February 5, 2018 9:07 PM
  • 
    Problem Description: 
        I'm trying to open a popup window for authorization users via google oauth.
        Google oauth call redirect in opened popup window with auth code, that we need to pass to parent window.
        To do this I need to call window.opener's function from that popup.
        In all browsers it works fine, but Edge. In Edge window opens on full screen and window.opener parameter in it is null.

    Steps to Reproduce:
        Code:
        1. Run Microsoft Edge
        2. Go to https://littlebigsnake.com
        3. Open console
        4. enter window.open("https://accounts.google.com/o/oauth2/auth", "new", "width=800,height=600,resizable=yes,toolbar=no,location=no,menubar=no,status=no,directories");

        UI Example:
        1. Run Microsoft Edge
        2. Go to https://littlebigsnake.com
        3. Push play
        4. Press google oauth button

    Actual Result:
        Edge opens new fullscreen window without any information about opener ( window.opener == null )

    Expected Result:
        Edge opens popup window with 800x600px size and window.opener parameter != null.

    Any Workarounds:
        1. Use other browsers
        2. Open blank page
    window.open("", "new", "width=800,height=600,resizable=yes,toolbar=no,location=no,menubar=no,status=no,directories");
            or relative page
      window.open("https://littlebigsnake.com/auth_vk.html", "new", "width=800,height=600,resizable=yes,toolbar=no,location=no,menubar=no,status=no,directories");

    Tuesday, February 6, 2018 10:53 AM
  • Hi,

    something appears to BLOCKING your popup window when you run it on Edge. I disable flash in Edge and use the Adblock + extension.

    You should test by running Edge in InPrivate mode to see if one of your extensions or the built-in popup blocker is blocking your popup window.

    a common design pattern is to use just window.open([url]) (viz: no size or position constraints)

    Credential validation services like FB connect or Google should be opened in a new window/tab without position or size arguments.

    or

    Replace the scripted window with just an action link.. <a href="url" target="_blank">login with google</a>

    Your site has no feature detection for IE ActiveX filtering or Flash blocking extensions... Flash (if supported) is pre-installed on modern devices.... the adobe getflash url will only confuse visitors.


    Rob^_^

    Thursday, February 8, 2018 9:58 PM
  • Hi Rob,

    We're observing the same issue on our end. The popup is not being blocked by the browser: it is displayed, not respecting the windowFeatures given, and the call to window.open returns null which does not respect the specs:

    "If the window couldn't be opened, the returned value is instead null"

    Here, the popup is actually opened. I think this only happens on Edge 15+. I noticed that when the main page is `http:` and it opens a popup to `https:`, it could create such issue. But we're also observing it when both origins are https:.

    Let me know if you need any other info, it's a pretty big issue.

    Thanks!

    Thomas

    (My account is not verified so I couldn't provide links to MDN Web Docs with the specs)

    Monday, February 26, 2018 11:08 PM
  • Hi,

    try running edge in InPrivate mode, so no extensions (form fillers) or site cookies are involved. Its normal for window.open IN EDGE to ignore some legacy size and position features and UI features.... I imagine that the google apis allow you to specify the size of the popup in their api settings....

    the common design pattern(for all web browsers, desktop and mobile) (for credential verification api's like FBConnect and google plus) is to use window.open(url)... viz without any 'features'..... that is open the credential verification domain in its own window, without any size or position constraints. Both the domains of the parent window and the credential verification service must support and use https.

    this forum is for IE web development questions... there is an Edge developer forum at stackoverflow.com.....there is also the developers.google.com forums.

    Without a reproduction url, its impossible for a confident guess at an answer.

    Regards.


    Rob^_^

    Thursday, March 1, 2018 4:33 AM
  • Hi Rob,

    Thanks for your response. You can try it yourself here: https://developers.google.com/identity/sign-in/web/sign-in. There's a Sign in With Google button that opens a popup based OAuth flow.

    It does pass window features in the window.open call (Disclaimer: I'm a developer working on the Google Sign-In library), which, until Edge 14, were respected.

    However, starting Edge 15, it seems that sometimes the window features aren't respected, window.open isn't returning the Window instance, and the popup doesn't have access to window.opener. This has broken popup flows.

    This sounds like an issue with Edge's handling of popups, and I'm having hard times finding the right place to ask questions, SO only offers workaround (or developers recommending switching to redirect flows, which we cannot as every app does what they want).

    Where should I raise my concern?

    Thanks!

    Thursday, March 1, 2018 11:42 PM