--- title: Response.url slug: Web/API/Response/url translation_of: Web/API/Response/url --- <div>{{APIRef("Fetch")}}</div> <p>The <strong><code>url</code></strong> read-only property of the {{domxref("Response")}} interface contains the URL of the response. The value of the <code>url</code> property will be the final URL obtained after any redirects. </p> <h2 id="Syntax">Syntax</h2> <pre class="syntaxbox">var <var>myURL</var> = <var>response</var>.url;</pre> <h3 id="Value">Value</h3> <p>A {{domxref("USVString")}}.</p> <h2 id="Example">Example</h2> <p>In our <a href="https://github.com/mdn/fetch-examples/tree/gh-pages/fetch-response">Fetch Response example</a> (see <a href="http://mdn.github.io/fetch-examples/fetch-response/">Fetch Response live</a>) we create a new {{domxref("Request")}} object using the {{domxref("Request.Request","Request()")}} constructor, passing it a JPG path. We then fetch this request using {{domxref("GlobalFetch.fetch","fetch()")}}, extract a blob from the response using {{domxref("Body.blob")}}, create an object URL out of it using {{domxref("URL.createObjectURL")}}, and display this in an {{htmlelement("img")}}.</p> <p>Note that at the top of the <code>fetch()</code> block we log the response <code>URL</code> to the console.</p> <pre class="brush: js">var myImage = document.querySelector('img'); var myRequest = new Request('flowers.jpg'); fetch(myRequest).then(function(response) { console.log(response.url); // returns https://developer.mozilla.org/en-US/docs/Web/API/Response/flowers.jpg response.blob().then(function(myBlob) { var objectURL = URL.createObjectURL(myBlob); myImage.src = objectURL; }); });</pre> <h2 id="Specifications">Specifications</h2> <table class="standard-table"> <tbody> <tr> <th scope="col">Specification</th> <th scope="col">Status</th> <th scope="col">Comment</th> </tr> <tr> <td>{{SpecName('Fetch','#dom-response-url','url')}}</td> <td>{{Spec2('Fetch')}}</td> <td>Initial definition</td> </tr> </tbody> </table> <h2 id="Browser_compatibility">Browser compatibility</h2> <p>{{Compat("api.Response.url")}}</p> <h2 id="See_also">See also</h2> <ul> <li><a href="/en-US/docs/Web/API/ServiceWorker_API">ServiceWorker API</a></li> <li><a href="/en-US/docs/Web/HTTP/Access_control_CORS">HTTP access control (CORS)</a></li> <li><a href="/en-US/docs/Web/HTTP">HTTP</a></li> </ul>