Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. Location
  4. pathname

Location: pathname property

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

Thepathname property of theLocationinterface is a string containing the path of the URL for the location. If there is no path,pathname will be empty: otherwise,pathname contains an initial '/' followed by the path of the URL, not including the query string or fragment.

Value

A string.

Examples

js
// Let's say we are on the URL https://developer.mozilla.org/en-US/docs/Web/API/Location/pathname#examplesconsole.log(location.pathname); // '/en-US/docs/Web/API/Location/pathname'

Specifications

Specification
HTML
# dom-location-pathname-dev

Browser compatibility

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2026 Movatter.jp