The "mime_types_handler" manifest key registers your extension as a handler for supported MIME types, such as application/pdf. When a user opens a document of a registered MIME type, Chrome loads your handler page in place of its built-in viewer.
For more information and examples, see the chrome.mimeHandler API documentation.
{
// ...
"mime_types_handler": {
"application/pdf": {
"handler_url": "viewer.html",
"can_embed": true
}
},
// ...
}
"mime_types_handler"(dictionary, optional)- Maps MIME types to the extension pages that render them. As of Chrome 151,
application/pdfis the only MIME type available to public handlers. Declaring an unsupported MIME type causes an installation warning. "handler_url"(string, required)- The HTML file to display when a document of the corresponding MIME type is opened. This file must be located within your extension.
"can_embed"(boolean, optional)- Specifies whether to handle documents embedded in
<embed>,<object>, or<iframe>elements. Defaults tofalse, meaning the handler only receives top-level navigations.