Harlan said:
Curious, I tested these out and found that they do work in both IE6 and
Firefox 2--except that Firefox then goes and changes all the backslashes
to forward slashes in the Address field. My approach works in IE. It
doesn't in Firefox, but I don't see why.
Because as I have repeatedly said, "localhost" is the only useful value
for the "host" part of "file://" URLs.
Putting a host in (either domain name or IP address) does *not* mean that
the client must attempt to fetch the file from that host via some sort of
network protocol -- it means that the user may access the file from that
host. So "file://HOST/SOMEFILE" is not an instruction to the client to
download SOMEFILE from HOST, but is an instruction to the user to access
SOMEFILE from HOST -- this might require a physical walk over to HOST to
access the file.
If a browser resolves "file://HOST/SOMEFILE" by using CIFS (i.e. the
protocol by which Windows machines share files and printers) to retrieve
the file automatically, then that is a proprietary extension to the file
protocol -- and this seems to be what IE is doing. Hardly surprising.
I've never seen anyone claim that an absolute reference to another host
is to be stated as though it were *relative* to the local machine.
File URLs *can* be stated relative to another machine -- that's why the
facility to specify a host exists. However, doing so is useless, because
the file protocol specifies no mechanism which can be used to retrieve the
file from another machine -- you just need to walk over there and access
it.
For example:
file://ophelia.g5n.co.uk/vol/music/pulp_-_common_people.ogg
refers to a particular file on my computer. However, that is useless to
anyone who isn't logged into my computer. As I have SAMBA installed, if
you were on my LAN however, you could access the same file at:
\\ophelia\juke\pulp_-_common_people.ogg
Knowing that UNC path, the file protocol URL must consist of:
file://localhost/\\ophelia\juke\pulp_-_common_people.ogg
file:///\\ophelia\juke\pulp_-_common_people.ogg
(I like to use backslashes in the UNC path because it makes it clearer as
to which slashes are part of the path and which are part of the file://
protocol prefix to it.)
But without knowing the UNC path, there's no way you could access that
file from your computer. So it only makes practical sense to use file://
URLs which are relevant to your local machine.
--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 7 days, 4:10.]
Sharing Music with Apple iTunes
http://tobyinkster.co.uk/blog/2007/11/28/itunes-sharing/