Documentation: Chrome Offscreen API
A promise-based wrapper for the Chrome offscreen API to create and manage offscreen documents.
- createOffscreen(parameters)
- closeOffscreen()
- hasOffscreen()
- getOffscreenContext()
- getOffscreenUrl()
- getOffscreenPath()
- hasOffscreenUrl(url)
- hasOffscreenPath(path)
createOffscreen(parameters: chrome.offscreen.CreateParameters): Promise<void>
Creates an offscreen document with the specified parameters.
closeOffscreen(): Promise<void>
Closes the existing offscreen document.
hasOffscreen(): Promise<boolean>
Checks whether an offscreen document is currently open.
getOffscreenContext(): Promise<chrome.runtime.ExtensionContext | undefined>
Returns the current offscreen document context, if one is open.
getOffscreenUrl(): Promise<string | undefined>
Returns the current offscreen document URL, if one is open.
getOffscreenPath(): Promise<string | undefined>
Returns the current offscreen document path within the extension, if one is open. Query parameters and hash fragments are not included.
hasOffscreenUrl(url: string): Promise<boolean>
Checks whether the current offscreen document matches the given URL.
hasOffscreenPath(path: string): Promise<boolean>
Checks whether the current offscreen document matches the given extension path. Query parameters and hash fragments are ignored.