News URLs like
mailto URLs, might not be supported by all browsers.
FILE
File URLs are
intended to reference files contained on the local disk. In other words, they
refer to files located on the same system as the browser. For local files, file
URLs take one of these two forms: the first with an empty hostname (three
slashes rather than tow ) or with the hostname as locaslhost:
File://dir1/dir2/file
File://localhost/dir1/dir2/file
Depending on
your browser, one or the other will usually work. (if you’re in doubt, you can
open the file from within your browser and look at the address bar to see what
its file:URL is.)
File URLs are
very similar to FTP URLs. In fact, if the host part of a file. URL is not empty
or local host. You browser will try to find the given file by using FTP.both of
the following URLs result in the same
file being loaded in the same way.
File://somesystem.com/pub/dir/foo/file.html
Ftp://somesystem.com/pub/dir/foo/file.html
Probably the
best use of file URLs is in startup pages for your browser (which are also
called home pages.). in this instance, because you’ll almost always be
referring to a local file, using a file RUL makes sense.
The problem with
file URLs is that they f\reference local files, where local means on the same
system as the browser pointing to the file-not the same system from which the
page was retrieved! If you use file URLs as links in your page, and someone
from elsewhere on the internet encounters your page and tries to follow those
links, that person’s browser will attempt to find the file on her local disk
(and generally will fail). Also, because file URLs use the absolute pathname to
the file, if you use file URLs in your page, you can’t move that page elsewhere
on the system or to another system.
If your
intention is to refer to files that are on the same file system or directory as
the current page, use relative pathnames rather than file URLs. With relative
pathnames for local files and other URLs for remote files, you shouldn’t need
to use a file URL at all
No comments:
Post a Comment