Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Forward slashes in http protocol declaration in URL

I have just noticed that on HTML form validation for an input type of url that the double forward slash '//' after the protocol: is not required. I tried entering URLs in to many browsers without the forward slashes and they all work e.g. http:www.web-dewd.com works in Chrome, Firefox, Edge, Opera, and dare I say it, even IE11.

I cannot find any specific definition which states whether they are required or not. I spent a good few minutes on https://www.w3.org/standards/ without any luck. The best I could find was an interview with Tim Berners-Lee stating they are not required: http://www.dailymail.co.uk/sciencetech/article-1220286/Sir-Tim-Berners-Lee-admits-forward-slashes-web-address-mistake.html :

But with the colon in there as well, it turns out people never use the slash slash...

This article from ZDNet states:

there is practically no reference to the double forward-slash on the web

I would argue that slashes are recommended, but does anyone know and is able to provide evidence of what the correct standard is?

Somewhat ironically, Stackoverflow does require // when entering a link, as do other editors when determining to convert text to a link e.g. Microsoft Outlook.

like image 629
dewd Avatar asked Sep 11 '25 13:09

dewd


1 Answers

Source

PrePrefix: To be a Uniform Resource Locator as currently defined by the URI working group, the whole string must start with a constant prefix "URL:"

this part says that valid URL starts with protocol: and does not states anything about //

Internet protocol parts Those schemes which refer to internet protocols mostly have a common syntax for the rest of the object name. This starts with a double slash "//" to indicate its presence, and continues until the following slash "/".


To indicate URL string must start with protocol: and // is just common syntax to indicate domain name start.

When replacing URL usually you look for http[s]:// instead of http[s]:. It's just common practice, and does not mean that all web developers will use that.

like image 90
Justinas Avatar answered Sep 13 '25 04:09

Justinas