VOOZH about

URL: https://www.geeksforgeeks.org/html/html-dom-anchor-pathname-property/

⇱ HTML DOM Anchor pathname Property - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

HTML DOM Anchor pathname Property

Last Updated : 2 Jan, 2024

The Anchor pathname Property in HTML DOM is used to set or return the path name part of the href attribute value.

Syntax:

  • It returns the pathname property.
    anchorObject.pathname
  • It is used to set the pathname property.
    anchorObject.pathname = path

Property Values: It contains the value i.e. path which specify the path name of the URL.

Return Value: It returns a string value which represents the path name of the URL.

Example 1: This example returns the path name of the URL.

Output:

👁 anchor-pathname

Example 2: This example sets the path name of the URL.

Output:

👁 anchor-pathname-2

Supported Browsers:

  • Google Chrome
  • Internet Explorer 10.0 +
  • Firefox
  • Opera
  • Safari
Comment
Article Tags: