We are cruising ðŸš¢ through all these types.
Next, I want to talk about the input with type set to URL.
Oh, I hadn't really designed that URL logo nicely, did I?
But anyway, that's not what's important.
And why would you want an input type of URL?
I don't know,
maybe you want to ask the user if they have a website of their own and you're asking them to type it
in.
Maybe you're asking them for their favorite search engine.
I don't know.
But let's say you want to include an input with type URL.
How does it work?
Well, obviously its use is to capture URLs. But it's got a huge downside and that is it only takes
full absolute URLs and this, in my opinion, restricts its usefulness.
It's just annoying.
There's no option to be able to capture just a domain name or just a path, for example.
And what this means is that the browser will display an error if no protocol is entered, such as HTTP
for example, or if the URL is otherwise malformed.
"Okay
Clyde, give me an example."
Okay.
Take this as an example.
This would pass.
This makes sense.
It's a URL.
But what about if the user types one of these two?
Do you think they would pass?
No.
This will result in an error being shown by the browser and it won't submit your form.
How irritating. And over and above this,
right,
even if we take the top example of https://twitter.com, just because a URL is well-formed doesn't mean
that it refers to a location that actually exists.
You'd have to have server side code that checks this for you.
And because of all these restrictions, it kind of feels like a missed opportunity for me that different
parts of a URL cannot be specified.
But it is what we have at the moment. And there is not only downsides with URLs.
The other benefit we have, as with most other widgets, is the UI component.
Phones usually customize keyboard pop-ups when the URL input type is used.
For example, IOS
customizes its keyboards
with what?
That's right.
With these symbols, whenever it sees the type set to URL. And over and above the period, comma and forward
slash,
they also include common top-level domains such as ... ".com".
So it just means you as a user don't have to type ".com", you just see the text displayed.
So it does help from that aspect.
And if you're anything like me, you love visual examples.
So here you go, right?
That's kind of what the keyboard will look like, and that does help.
But anyway, I don't want to harp on too much on this type.
I don't particularly find it that useful.
So let's move on.