Search code examples
javascriptgoogle-chromeincognito-mode

Cannot gain focus on Incognito window


How do I set focus on a new incognito window? I cannot gain focus on a new incognito window. I can gain the focus when I set 'incgonito': false but not when I set it to true:

chrome.tabs.query({
                  'active': true,
                  'windowId': chrome.windows.WINDOW_ID_CURRENT
                  },
                  function(tabs) {
                      var url = tabs[0].url;
                      chrome.windows.create({
                                             "url": url,
                                             focused: true,
                                             "incognito": true
                                             },
                                             function(window){
                                                chrome.windows.update(
                                                        window.id, 
                                                        {focused: true})
                                             });
                  }
);

Solution

  • First I named the window by:

    chrome.windows.create(function(window){window.name = "portal";});
    

    then

    window.open("", "portal").focus();