If I ask a user for a URL, and they type in something like 'www.google.com', should I assume they meant
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
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).
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:
if(!preg_match('/^http/', $url)) $url = "http://".$url;