跳至主要内容

[Chrome Extension] chrome.windows / windows

chrome.windows @ chrome

Manifest Permission

記得要先在 manifest.json 中取得 tabs 的權限:

// manifest.json
{
"name": "My extension",
...
"permissions": ["tabs"],
...
}

API

getCurrent

chrome.windows.getCurrent(object getInfo, callback<window>)

// window object
{
id: 9,
alwaysOnTop: false,
focused: true,
height: 877,

incognito: false,
left: 0,
state: 'normal',
top: 23,
type: 'normal',
width: 960,
}