pathname property (location, a, area)
Specifies or retrieves the path component of the URL assigned to the object (relative to the host).
Use the hostname property to get the host name of the URL.
You can find the related objects in the Supported by objects section below.
This property is read/write.
String that sets or retrieves the path.
Default: this property has no default value.
Example HTML code 1:
This example illustrates the use of the pathname property for an anchor:
Did you find this example helpful?
User Contributed Comments