Load extension (content scripts) depending on mime type and/or content-type

Hello,

Is there a way to load an extension when the mime type and/or the content-type matches a specific value ?

In my case, I want to load an extension to render AsciiDoc files. So when the mime type and/or the content-type is text/asciidoc, the extension should loaded.

As far as I know, the only workaround is to match <all_urls> and then check if the content-type is equals to text/asciidoc. Is there a better way ?

Thanks,
Guillaume

You could probably use the webRequest API to monitor the headers of "main_frame" responses and only inject in frames that received a matching document. You’d still need the <all_urls> permission, but execute your content scripts a lot less.