Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I wanted to view .cpp source code in FireFox so I selected FireFox as the application to open it with and checked "always do this" but when I clicked the link new tabs kept opening up and wouldn't stop. I simply want to view .cpp files in FireFox how can I do this and why didn't it work?

I'm viewing a website with a link to a .cpp file and I want to click the link and show the text in the browser. I'm using latest FireFox on Windows 7 Enterprise.

share|improve this question

2 Answers 2

up vote 3 down vote accepted
  • Using explorer, go to a .cpp file right click -> select properties.
  • There is a section in the 'General' tab which shows the program that opens this file.
    • XP systems click the Opens with... button (In Vista/7, the button says Change...)
  • Select a text editor instead of firefox.

Firefox is not made to see source code other than .htm/.html and text .txt files. You'd be better off using a specialized text editor like Notepad++ wich is free and a great choice for source code/files.

After having chosen a text editor click Apply and hit OK button. You are now good to go. Hope this helps you out. This is a simple solution.

share|improve this answer
    
+1 for Notepad++. –  Robotnik Jul 31 '12 at 0:12
    
Why can't FireFox view .cpp files, they are just text? –  Celeritas Jul 31 '12 at 4:00
    
@Celeritas - because according to Firefox .cpp isn't plain text. If you really want firefox to treat .cpp as text I suggest having a look at kenorb's answer - you'll need to change firefox's definition of plain text to include files ending in .cpp –  Robotnik Aug 1 '12 at 6:20

Depending on your system, you can add .cpp format as a known mimetype of plain/text or whatever. See: Properties -> Applications. Try as well dragging the file into your Firefox instance. Other workaround is to change the extension of your cpp to txt or html. I'm not sure which Firefox are you using, but mine 14.0.1 opening .c and .cpp files without any problems (without any configuration changes), so also I'd advise you to upgrade your Firefox.

P.S. Still don't understand how your new tabs kept opening up and wouldn't stop (what exactly happening). You don't mention your version or OS. And what are you trying to do exactly, to open .cpp from the websites, or open .cpp files which is on your local computer.

share|improve this answer
    
i've had it happen before, I accidentally told firefox to "always open this file type with" and chose firefox, thinking it would just preview the file. what firefox gets caught in a loop doing is opening a new tab, and doing the default action for that file, which is "open with firefox" which opens a new tab, so on, so forth –  Robotnik Jul 31 '12 at 1:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.