Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force Firefox to open a file which does not have a .txt extension as if it did have one?

Tags:

firefox

I have files which are just plain text, but have extension which is not .txt. Lets say the extension is .abc.

When I click on a link that points to such a file, such as file.abc, I'd like Firefox to open the file as if it was file.txt (i.e. open it inside Firefox, listed inside Firefox itself, just like what happens when I click on file.txt) instead of it asking how if I want to save it or open it, and then I have to go select the application to open it with, such Notepad or whatever.

I went to Tools → Options → Applications, but did not know what to do.

Added: Based on the comment below and the answer so far, it looks I did not explain myself well.

I want Firefox to open the file as if the file had .txt extension. When you click on a link in Firefox which has .txt, what does Firefox do? It does not open the file in Notepad or whatever, it opens right there, inside the browser, showing the listing of the file. I want to the same to happen when .abc extension.

I do not want to go around mess up with the Windows OS for this.

like image 311
Robert H Avatar asked Feb 08 '12 10:02

Robert H


People also ask

Can a browser open .txt file?

The Google Chrome, Mozilla Firefox, and Microsoft Edge web browsers all allow users to open TEXT files. Keep in mind, however, that you will not be able to edit your TEXT file in a web browser. In Chrome and Firefox, you can simply drag and drop your file into a browser window to open it.

How do I force a file to open in browser instead of downloading Firefox?

Click on the '''Downloads''' icon in the toolbar (it should automatically open when you download a file). 2. Right-click on the file and enable '''Always Open Similar Files''' 3. Go to '''Settings''', and scroll down to the ''Applications'' section 4.


1 Answers

For a quick solution, you can add view-source: before the url. This also works in Chrome.

like image 132
Yay295 Avatar answered Oct 09 '22 13:10

Yay295