The url
read-only property of the Request
interface contains the URL of the request.
The url
read-only property of the Request
interface contains the URL of the request.
A string indicating the URL of the request.
In the following snippet, we create a new request using the Request()
constructor (for an image file in the same directory as the script), then save the URL of the request in a variable:
js
const myRequest = new Request("flowers.jpg"); const myURL = myRequest.url; // "https://github.com/mdn/dom-examples/tree/main/fetch/fetch-request/flowers.jpg"
Specification |
---|
Fetch Standard # ref-for-dom-request-url③ |
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
url |
40Fragment support added in Chrome 59. |
14 | 39 | No | 27Fragment support added in Opera 46. |
10.1 | 40Fragment support added in Chrome 59. |
40Fragment support added in Chrome 59. |
39 | 27Fragment support added in Opera 46. |
10.3 | 4.0Fragment support added in Samsung Internet 7.0. |
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Request/url