Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"View As MIME Type" in Chrome or Firefox [closed]

Is there any way to force either Firefox or Chrome to interpret a loaded resource as a particular MIME type?

For example, the raw code views provided by online SCC interfaces such as Google Code send content as text/plain by default. If I'm looking at an HTML file, I'd like to be able to override this in the browser and view it as text/html.

Are there any extensions or hidden commands for Firefox or Chrome that provide "View as MIME type" functionality?

like image 443
kpozin Avatar asked Jan 26 '11 16:01

kpozin


2 Answers

Shameless plug: I just published a (free) Chrome extension to do just what you ask. It's available on the Chrome web store. It works by listening to the chrome.webRequest.onHeadersReceived event and patching in a custom content-type HTTP header. If you'd like the build it yourself or see how it's implemented, the source is available on GitHub.

like image 80
Ori Avatar answered Sep 20 '22 14:09

Ori


For Firefox, there is an add-on provides almost the function you wanted: https://addons.mozilla.org/en-US/firefox/addon/force-content-type/ . No idea if there is a Chrome extension or not.

Even if the functionality exists, I wouldn't recommend you to use it in your example: Arbitrary HTML would have access to google.com domain for cookie and script, which is really really bad in terms of security.

like image 25
timdream Avatar answered Sep 21 '22 14:09

timdream