chrome.mimeHandler

Description

Use the chrome.mimeHandler API to handle MIME type streams in third-party extensions.

Availability

Pending

Manifest

The following keys must be declared in the manifest to use this API.

"mime_types_handler"

Types

MimeHandlerOptions

Properties

  • enabled

    boolean

    Whether this handler is active for the given MIME type.

StreamInfo

Properties

  • embedded

    boolean

    True if loaded in an embedded context (iframe/embed/object).

  • mimeType

    string

    The MIME type of the intercepted content.

  • originalUrl

    string

    The original URL the user navigated to.

  • responseHeaders

    object

    HTTP response headers as key-value pairs.

  • streamUrl

    string

    The URL to fetch the stream data from.

  • tabId

    number

    The tab ID containing the document.

Methods

abortAndFallbackToNativeHandler()

chrome.mimeHandler.abortAndFallbackToNativeHandler(): Promise<void>

Aborts current stream handling and hands the content off to the user agent's native handler. After this call the extension frame will be torn down; callers should not expect further execution.

Returns

  • Promise<void>

getMimeHandlerOptions()

chrome.mimeHandler.getMimeHandlerOptions(
mimeType: string,
)
: Promise<MimeHandlerOptions>

Reads the persisted options for a MIME type. Returns defaults (enabled=true) if none have been stored.

Parameters

  • mimeType

    string

    The MIME type whose options to read.

Returns

  • Promise resolved with the persisted options for the MIME type.

getStreamInfo()

chrome.mimeHandler.getStreamInfo(): Promise<StreamInfo>

Retrieves stream information for the current MIME handler context. Must be called from within a MIME handler extension page.

Returns

setMimeHandlerOptions()

chrome.mimeHandler.setMimeHandlerOptions(
mimeType: string,
options: MimeHandlerOptions ,
)
: Promise<void>

Sets the configuration options for a specified MIME type.

Parameters

  • mimeType

    string

    The MIME type to configure.

  • The new options to use.

Returns

  • Promise<void>

    Promise resolved when the configuration has been set.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026年07月02日 UTC.