linucks
linucks

Reputation: 815

Viewing an xml file with a different file extension as xml within Google Chrome

I'm sure this should be simple, but I've got totally stuck. What I'd like to do is view CML (Chemical Markup Language) files on my harddrive within chrome. If I view an arbitrary xml file chrome displays this beautifully.

If I view a cml file on the web, this usually displays fine. However, if I try and view a cml file on my harddrive, chrome insists on downloading it. More simply:

http://www.xml-cml.org/examples/schema24/table1.cml - works file://Users/me/table1.cml - doesn't

If I rename the file extension to xml, then it works.

I know there are umpteen extensions I could download to do this, but it seems overkill as chrome already does what I want.

Upvotes: 1

Views: 488

Answers (1)

abraham
abraham

Reputation: 47833

CML files get rendered as XML from the server because the server is telling Chrome it is XML with header Content-Type:application/xml. When a local file is opened there is no Content-Type header so Chrome guesses off of the file extension and in this case is not aware of CML. You could open a feature request for Chrome to read CML files as XML but I don't know if they will implement it: http://new.crbug.com

Upvotes: 1

Related Questions