windows

ブラウザーウィンドウと相互作用します。この API を使って開いているウィンドウの情報を取得したり、ウィンドウを開き、修正し、閉じることができます。ウィンドウのオープン、クローズ、アクティベートのイベントをリッスンすることもできます。

windows.WindowType

ブラウザーウィンドウの this の型。

windows.WindowState

ブラウザーウィンドウの状態。

windows.Window

ブラウザーウィンドウについての情報を含む。

windows.CreateType

作成するブラウザーウィンドウの型を指定する。

定数

windows.WINDOW_ID_NONE

ブラウザーウィンドウがないことを表す windowId の値。

windows.WINDOW_ID_CURRENT

現在のウィンドウを表す windowId の値。

メソッド

windows.get()

与えられた ID のウィンドウの詳細を取得します。

windows.getCurrent()

現在のウィンドウを取得します。

windows.getLastFocused()

最も最近フォーカスされたウィンドウを取得します — 典型的には「最上位」のウィンドウです。

windows.getAll()

すべてのウィンドウを取得します。

windows.create()

新しいウィンドウを作成します。

windows.update()

ウィンドウのプロパティを更新します。これを使ってウィンドウの移動、リサイズ、フォーカス(外し)などを行います。

windows.remove()

ウィンドウと、そのタブのすべてを閉じます。

イベント

windows.onCreated

ウィンドウが作成された時に発火します。

windows.onRemoved

ウィンドウが閉じられた時に発火します。

windows.onFocusChanged

現在フォーカスされているウィンドウが変わった時に発火します。

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Firefox for Android
Safari on iOS
windows
CreateType
WINDOW_ID_CURRENT
WINDOW_ID_NONE
Window
Window.alwaysOnTop
Window.focused
Window.height
Window.id
Window.incognito
Window.left
Window.sessionId
Window.state
Window.tabs
Window.title
Window.top
Window.type
Window.width
WindowState
WindowState.docked
WindowState.fullscreen
WindowState.maximized
WindowState.minimized
WindowType
WindowType.app
WindowType.devtools
WindowType.panel
create
get
get.getInfo
getInfo.windowTypes
getAll
getAll.populate
getAll.windowTypes
getCurrent
getCurrent.getInfo
getInfo.windowTypes
getLastFocused
getLastFocused.getInfo
getInfo.windowTypes
onBoundsChanged
onCreated
onFocusChanged
onRemoved
remove
update
update.drawAttention
update.focused
update.height
update.left
update.state
update.titlePreface
update.top
update.width

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
See implementation notes.
Uses a non-standard name.

Example extensions

メモ: This API is based on Chromium's chrome.windows API. This documentation is derived from windows.json in the Chromium code.Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.