Wednesday, June 5, 2024
 Popular · Latest · Hot · Upcoming
156
rated 0 times [  159] [ 3]  / answers: 1 / hits: 26747  / 13 Years ago, tue, november 8, 2011, 12:00:00

There is a page (url), I request it by XMLHttpRequest, but I'm not getting response from requested url, It's directing request to another page,



requesting --- > page.php

getting reponse from > directedpage.php



and the question is how can I get response url? (directedpage.php in example)


More From » ajax

 Answers
48

The final URL (after following all redirects) is available in the responseURL attribute of a XMLHttpRequest instance.
This feature is new and only supported in Firefox 32 stable in September 2014 [ref] and Chrome 37.0.2031.0 stable in August 2014 [ref] (and probably also Opera 24). responseURL is not (yet) supported in IE 11 or Safari 7 and older browsers. For these browsers, the previous answer is still true:




XMLHttpRequest automatically follows redirects, without saving the served URLs in a property. The Location header can neither be retrieved through the .getResponseHeader().




References:




[#89235] Monday, November 7, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
justynkaina

Total Points: 742
Total Questions: 83
Total Answers: 102

Location: Hong Kong
Member since Tue, Oct 19, 2021
3 Years ago
;