Language

Input Type URL


When a single absolute URL is given to the input element. In order to allow the input element to handle this type of value properly, the input type="url" is used.


Using input type="url" allows the user to change the URL and leave it blank. If the input element is not empty then the user must provide a valid URL, which must start with https://.

Input type URL validation method explained

Example

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
   <form>
        <label for="urls">Enter URL</label>
        <input type="url" id="urls">
        <input type="submit" value="Submit">
    </form>
</body>
</html>