Take the 2-minute tour ×
User Experience Stack Exchange is a question and answer site for user experience researchers and experts. It's 100% free, no registration required.

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?

share|improve this question
add comment

4 Answers

up vote 7 down vote accepted

It depends on the context in which you're asking for a URL. If the url is supposed to be a fully qualified URL (http://example.com/foo/bar/baz) you can safely assume http:// if they haven't prefixed it with http, https, file, ftp, and any other possible acceptable protocols.

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 http:// as starter text

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).

share|improve this answer
    
Nice answer. I didn't know the ctrl + L thing. –  Benny Skogberg May 6 '12 at 6:17
    
+1, but I would not restrict the acceptable protocols to the few that are very well known. At work we use a custom URI protocol to exchange links to specific information within our software. Typing that in a browser or in the "Run" box on the start menu will start our software and execute a query that corresponds to the info in the URI. Custom URI protocols need to be registered, so you should be able to enumerate the known protocols... –  Marjan Venema May 6 '12 at 8:25
    
@MarjanVenema, again, "It depends on the context in which you're asking for a URL". If you're asking a user for the link to their website (URL field in comments), you wouldn't accept anything other than http or https, so it truly depends on what protocols are accepted in the circumstances. If any protocol is acceptable, then you'd need to check if the user has provided a protocol. –  zzzzBov May 6 '12 at 16:35
1  
Yes, I wasn't arguing against that. I just tried to address that "if they haven't prefixed it with..." might just lead people to check for a specific and limited set of starter strings, instead of checking for all registered protocols, or, even better parsing the URI and checking for no or any protocol. –  Marjan Venema May 6 '12 at 17:39
add comment

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).

share|improve this answer
add comment

Most web browsers with address correction make this assumption. So I'd think you could too.

share|improve this answer
add comment

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:

if(!preg_match('/^http/', $url)) $url = "http://".$url;
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.