HTML: input type="url"
The URL input is designed for a web address and gives the browser a useful format check and mobile keyboard hint.
What you will learn
- How to label a URL field
- How browser validation and autocomplete support users
- Why URL input still needs server-side validation and safe handling
Minimal example
<label for="website">Website</label>
<input id="website" name="website" type="url"
autocomplete="url" placeholder="https://example.com" required>The browser can check whether the value resembles a URL. It cannot prove that the address exists, is safe, or belongs to the expected person.
Common mistakes
- Keep a visible label; the placeholder is only an example.
- Validate the submitted value on the server and handle redirects or untrusted URLs carefully.
- Use
input type="text"when the value is not actually a URL.