Prop Url Maxlength
# HTML DOM Input URL maxLength Property
[!(#) Input URL Object](#)
## Example
Get the maximum number of characters allowed in the URL field:
```javascript
var x = document.getElementById("myURL").maxLength;
```
_x_ output result:
30
[Try it Β»](#)
* * *
## Definition and Usage
The maxLength property is used to set or return the maxlength attribute of a URL field.
The maxLength property describes the maximum number of characters allowed in the URL field.
The default value is 524288.
**Tip:** If you need to set the length of the URL, that is, the number of characters, please use the (#) attribute.
* * *
## Browser Support
!(#)!(#)!(#)!(#)!(#)
All major browsers support the maxLength property.
**Note:** Internet Explorer or Safari browsers do not support HTML elements using the type="url" attribute.
* * *
## Syntax
Return the maxLength property:
_urlObject_.maxLength
Set the maxLength property:
_urlObject_.maxLength=_number_
## Property Values
| Value | Description |
| --- | --- |
| _number_ | Describes the maximum number of characters allowed in the URL field. The default value is 524288. |
## Technical Details
| Return Value: | A number, representing the maximum number of characters allowed in the URL field. |
| --- |
* * *
## More Examples
## Example
Set the maximum number of characters allowed in the URL field:
```javascript
document.getElementById("myURL").maxLength = "8";
```
[Try it Β»](#)
* * *
## Related Pages
HTML Reference Manual: (#)
* * (#)
YouTip