Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does "./" (dot slash)html, cause problems for any browsers

Tags:

html

css

In the world of shells, ./ is fairly common and not considered to be a dangerous way to refer to the current directory when specifying a path.

In HTML, however, we almost always leave out the ./ and just put the name of the file we want. Is this a stylistic convention, or is it due to some browsers simply not understanding ./ to mean "Current Directory"?

like image 349
basicallydan Avatar asked Dec 06 '22 00:12

basicallydan


1 Answers

The reason to use this in the shell is that the shell looks up executable commands in a mix of its internal commands, PATH directories and the current working directory. By using ./command, you unambiguously tell it to use command in the current directory, not elsewhere.

This does not apply to HTML/HTTP at all, so there's no good reason to use it. path and ./path always mean exactly the same thing in HTML.

like image 98
deceze Avatar answered Dec 27 '22 10:12

deceze