Complete syntax: file://host/path
If the host is localhost: it can be omitted and then resulting syntax is file:///path.
Is it actually possible to use hostnames other than localhost ? and In what situation has people ever used hosts other than localhost ?
"file:// / path" means that you are in a local network and the last
/means the root of your file system, so if you are always in a local network, yes you can omit the computer name(or hostname) but when you want to use a file that exists on another computer on the network, you need to define the hostname.if you are always in a local network and inside your own computer, not others on the network, file:/// is better because you aren't rely on hostname(in case of if it get changed).
but if you maybe need to point a file in another computer on the network, then you need the hostname.
localhostis a hostname itself! so when you can use localhost it means you can use other hostnames as well. if you open thehostsfile(in Linux or in Windows), you can find the localhost there, that is assigned to 127.0.0.1as a side note, if you are making a website(using a webserver), HTTP protocol maybe is a better choice for everywhere, (even relative paths is still HTTP not FILE).