View local html file with .asp extension in browser View local html file with .asp extension in browser google-chrome google-chrome

View local html file with .asp extension in browser


Chromium uses the system mime-type for the local files. On Linux you can change it in the xdg-open configuration:

$ mkdir -p ~/.local/share/mime/packages$ cd ~/.local/share/mime/packages$ touch application-x-asp.xml

Then edit the ~/.local/share/mime/packages/application-x-asp.xml:

<?xml version="1.0" encoding="UTF-8"?><mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">    <mime-type type="text/html">        <comment>Active Server Page</comment>        <icon name="text-html"/>        <glob-deleteall/>        <glob pattern="*.asp"/>    </mime-type></mime-info>

to set up the mime-type to text/html. On te end you have to logout/-in again, or just run:

$ update-desktop-database ~/.local/share/applications$ update-mime-database    ~/.local/share/mime


When your browser opens a file it uses the MIME type to decide which action it should take, typically download or open in the bowser.

So, for example, it encounters a zip file it will open the file save dialogue box and allow you to save the file.

And, if for example, you request a .asp from your browser which is served from a web server the browser will use the MIME type to decide which action to take, which will be to display in the browser.

The MIME type will be sent within the http headers and this would not be sent to the browser when you open your off-line .asp pages.

So if you could change the MIME type to "text/html" for .asp it should open it in the browser.

Unfortunately, there does not seem to be an option for changing MIME type / actions in Chrome.

You can change these setting in Firefox within Tools > Options > Content > FileTypes > Manage..

enter image description here


There is a way to open local, .asp files as HTML in Firefox.

Find your Firefox profile folder. On Windows 7, I found it here:

C:\Users\user\AppData\Roaming\Mozilla\Firefox\Profiles\738xdie.default\mimeTypes.rdf

Then add these lines to mimeTypes.rdf

<RDF:Description RDF:about="urn:mimetype:text/html"    NC:fileExtensions="asp"    NC:description="ASP Pages"    NC:value="text/html"    NC:editable="true"></RDF:Description>

Restart browser. Your local file will now render as HTML.

There may be a similar technique with Chrome.