superpan3000
superpan3000

Reputation: 43

Chrome extension - create window - focused property not working

I create a window with function

chrome.windows.create({
    focused: false
})

but the new window is always focused and go on top so is it a bug or I missing something?

Thanks

Upvotes: 1

Views: 1347

Answers (4)

Jan Croonen
Jan Croonen

Reputation: 719

It still is a problem on Windows. It is not a problem on my Mac.

On Windows, the work-around of superpan3000 himself works for me, for which I'm grateful!

I'm referring to the solution

function createWinSucceed(window) {
  var id = window.id;
  chrome.windows.update(id, { focused: false });
};

BTW When re-using the created window, no more flashing will occur.

Upvotes: 0

petewil-G
petewil-G

Reputation: 99

Can you try again with Today's canary build? The build may have been in a broken state for a few days with a recent checkin, but the developer told me it should be working now.

Upvotes: 1

superpan3000
superpan3000

Reputation: 43

Thank LarryLee, I tried as you suggest but it doesn't work

chrome.windows.create({
        focused: false
    }, function(window){
    chrome.windows.update(window.id, { focused: false })
})

still I changed to

chrome.windows.create({
        focused: **true**
    }, function(window){
    chrome.windows.update(window.id, { focused: false })
})

It works but it makes a flash when window creating and lose focus. Sometime it takes my focus on current working window and makes the computer slowly. I think it's not a good solution. Thanks

Upvotes: 0

LarryLee
LarryLee

Reputation: 26

Have you tried like this as the callback of creating window? But it seems that the new created window will still show and hide soon with this method.

function createWinSucceed(window) {
  var id = window.id;
  chrome.windows.update(id, { focused: false });
};

Upvotes: 0

Related Questions