Location: pathname-Eigenschaft
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.
Die pathname
-Eigenschaft des Location
-Interfaces ist ein String, der den Pfad der URL für die Position enthält. Wenn kein Pfad vorhanden ist, wird pathname
leer sein; andernfalls enthält pathname
ein anfängliches '/' gefolgt vom Pfad der URL, ohne die Abfragezeichenfolge oder den Fragment.
Wert
Ein String.
Beispiele
js
// Let's say we are on the URL https://developer.mozilla.org/en-US/docs/Web/API/Location/pathname#examples
console.log(location.pathname); // '/en-US/docs/Web/API/Location/pathname'
Spezifikationen
Specification |
---|
HTML # dom-location-pathname-dev |
Browser-Kompatibilität
Report problems with this compatibility data on GitHubdesktop | mobile | server | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
pathname |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
- See implementation notes.
- User must explicitly enable this feature.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.