This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

XMLHttpRequest.responseURL

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨август 2016 г.⁩.

Свойство XMLHttpRequest.responseURL доступно только для чтения, возвращает сериализованный URL ответа или пустую строку, если URL равен null. Если URL возвращён, любой URL фрагмент в URL будет стёрт. Значение responseURL станет окончательным URL, получаемым после любых редиректов.

Пример

js
var xhr = new XMLHttpRequest();
xhr.open("GET", "http://example.com/test", true);
xhr.onload = function () {
  console.log(xhr.responseURL); // http://example.com/test
};
xhr.send(null);

Спецификации

Specification
XMLHttpRequest
# the-responseurl-attribute

Совместимость с браузерами