Area username attribute

Definition and usage

username Attribute set or return href attribute value The username part.

href The attribute specifies the destination of the link in the specified area.

In the URL, the username part is the username entered by the user. It is specified between the protocol and the password part.

For example: https://billgates:bill234@www.example.com (billgates is the username, bill234 is the password).

Tip:Please use password attribute Set or return href attribute value The password part.

Instance

Example 1

Return the username part of the URL of the specific area in the image map:

var x = document.getElementById("venus").username;

Try it yourself

Example 2

Change the username part of the specific area in the image map:

document.getElementById("venus").username = "newUsername";

Try it yourself

Syntax

Return the username attribute:

areaObject.username

Set the username attribute:

areaObject.username = username

Attribute Value

Value Description
username Specifies the username part of the URL.

Technical Details

Return Value: A string value representing the username part of the URL.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Supported Not Supported Supported Not Supported Supported