As you can see, the mailto scheme basically has just the email address, so something like mailto:codebytez@example.com is a complete URL.
For the http scheme, the slashes have a historical reason. In the old days (pre-1990s) many networks used double slash to indicate that the first token is a hostname.
Therefore /someplace/file.txt would mean file.txt under the /someplace directory on the current file system but //someplace/file.txt would mean /file.txt at server "someplace"
Therefore the full translation of http://example.com/item1 would be:
http: | Use the http protocol |
//example.com | Connect to example.com |
/item.html | Ask the server for item.html |
(I've omitted port and fragment for simplicity)
The // is technically unnecessary to distinguish from local server because http requires that you need to specify a host to connect to.
When the file uri was originally implemented, it had the following forms and meanings
file:./file.txt | Load file from current directory (Browser's working directory) |
file:/directory/file.txt | Load file from root of current host |
file://mount/file.txt | Attempts to load file.txt from mount point. If mount point is invalid, attempts to load file.txt from root directory |
file:///directory/file.txt | Loads file.txt from root directory. This is the same as above with mount token missing. |
In modern browsers, everything upto the first slash is pretty much ignored. The mountpoint still works but often the browser ignores it and treats file://mount/file.txt as file:///file.txt
No comments:
Post a Comment