"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.
Is it actually possible to use hostnames other than localhost ?
localhost is a hostname itself! so when you can use localhost it means you can use other hostnames as well. if you open the hosts file(in Linux or in Windows), you can find the localhost there, that is assigned to 127.0.0.1
as 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).