If I ask a user for a URL, and they type in something like 'www.google.com', should I assume they meant http://www.google.com
?
|
|||
|
It depends on the context in which you're asking for a URL. If the url is supposed to be a fully qualified URL ( If, instead, you're asking for a url that may or may not be relative to the current domain, you wont be able to assume any protocol, although you could provide a default value of For a great example of where this is used, look no further than Stack Exchange's own link field in the popup used in the question/answer content editor (Ctrl + L). |
|||||||||||
|
The majority of users on my websites never enter HTTP:// at the start of web address, and most web browsers now are not displaying it. The default protocol should be http unless they specify something else (https for example). |
|||
|
Most web browsers with address correction make this assumption. So I'd think you could too. |
|||
|
I don't specify one way or the other from the user's pov, but when the link hits my server I prepend http:// if it's not present. It's a very simple line of PHP code:
|
|||
|