Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Trying to simply open an .html file using file:// on Linux -- it's adding an extra slash and not finding the file

  • 4 replies
  • 2 have this problem
  • 966 views
  • Last reply by JoyShafer

Ideally I'd like to be able to launch Firefox from my Linux command line and have it simply open an html file on my hard drive. Not knowing the exact syntax and not getting any love on my first few tries, I instead launched Firefox and typed file://path/to/myfile.html in the address bar. However, instead of looking in 'path/to/myfile.html' Firefox is adding an extra slash and then reporting that it can't find '/path/to/myfile.html'. I've tried a few variations but don't seem to be able to get around this.

Any suggesstions?

Ideally I'd like to be able to launch Firefox from my Linux command line and have it simply open an html file on my hard drive. Not knowing the exact syntax and not getting any love on my first few tries, I instead launched Firefox and typed file://path/to/myfile.html in the address bar. However, instead of looking in 'path/to/myfile.html' Firefox is adding an extra slash and then reporting that it can't find '/path/to/myfile.html'. I've tried a few variations but don't seem to be able to get around this. Any suggesstions?

Chosen solution

The file: protocol does take 3 slashes after the colon for some reason.

Does your shell allow you to right-click the file and open it in Firefox? This would be the quick and dirty way to discover the path Firefox prefers.

Read this answer in context 👍 2

All Replies (4)

Chosen Solution

The file: protocol does take 3 slashes after the colon for some reason.

Does your shell allow you to right-click the file and open it in Firefox? This would be the quick and dirty way to discover the path Firefox prefers.

You can also drag the file in a Firefox window and drop the file on empty space on the Tab Bar or the new tab (+) button to see its URL in the location/address bar.

Thanks @jscher2000. I figured it out about 1 minute after I posted my question -- I was just having a 'duh' moment.

Modified by JoyShafer

Thanks for your response. I'm using Unix without a shell, so no drag and drop love. I did figure out I can launch Firefox and open the file directly from the command line once I got the path right and added the slash at the front.