Jonathan Lam
Jonathan Lam

Reputation: 17351

file:/// for url path for local html files?

I'm just started web developing not long ago, and I'm wondering why running HTML on my computer comes up with file:/// and then the file path and name in the browser url bar. For example, what I'm testing right now is:

file:///D:/WebDesign/HTML/test/default.html

Why isn't it file://, or just the pathname?

Is there a certain reason for this?

thanks for any answers.

Upvotes: 5

Views: 26665

Answers (3)

cssyphus
cssyphus

Reputation: 40030

That is just standard URL code for a local file. A similar syntax is used to refer to a file on a network drive.

However, if you are attempting to develop like that you will run into problems, especially if you intend to test server-side functionality in languages like PHP. You may wish to look into installing a (free) program such as XAMPP or WAMP/MAMP that will emulate an apache server and allow you to test these things.

You can find some very helpful (free) tutorial videos here

Look at the first three videos here

And here's another that discusses installing XAMPP/WAMP

Upvotes: 0

Quentin
Quentin

Reputation: 943142

// is part of the general format of URI schemes.

The next / comes after the optional — if defaults to localhost — hostname (since you can have a network path for file URIs).

See the Wikipedia article for more details.

Upvotes: 4

Rahul Tripathi
Rahul Tripathi

Reputation: 172378

It is a standard URL code for a local file. Also Check out this:-

the slash is a general, system-independent way of separating the parts, and in a particular host system it might be used as such in a pathname (as in Unix systems) or internally mapped to another character

Upvotes: 1

Related Questions