Search code examples
google-chromecontent-typebrowser-extension

Force Chrome to open certain URLs based on Content-Type header


I tried looking for a Chrome extension that does this, but was unsuccessful in finding one. Basically, I want to hit a web service that returns a content type header of application/rdf+xml or application/xml and have Chrome automatically display the content inline. I have the XML Tree extension which displays the XML just fine, but Chrome by default will download files unless they have a certain extension.

My question is: Is there a way to force Chrome to open certain things inline based on Content-Type returned from the server? Extension or direct support in Chrome is fine with me. If one doesn't exist, I'll investigate developing one.


Solution

  • Great question, one I've been trying to answer for ages. Unlike firefox, chrome, and chromium, use an external xdg mime-type query to decide what helper applications to use, but one generally doesn't want to set chrome as a generic handler for application/rdf+xml. So I was very pleased to discover the chrome extension "application/...+json|+xml as inline." Available from the web store, or at

    https://github.com/andreineculau/chrome-inline-media-type

    Thanks andreineculau!