javascript - Determining what jQuery .ajax() resolves a string of redirects to -
i'm aware redirects followed automatically, , have little/no control on process. fine, i'm still interested in request ends up. possible see url request ends at?
i not want rely on returned html tell me am.
sample code:
var originalurl = '/this/will/be/redirected'; $.ajax({ url: originalurl, datatype: "html", success: function(data, statustext, jqxhr) { var endpointurl = insertmagichere(); alert("our query " + original + " ended @ " + endpointurl + "!"); } });
i'm looking around in jqxhr it, no luck far. (though, i'm new this, right under nose)
so far know (and have testet) possible detect if there has been redirect , how many redirects made (but not where).
you can have code:
var xhr = $.ajax({ url: originalurl, datatype: "html", success: function(data, statustext, jqxhr) { console.log(data); console.log(statustext); console.log(jqxhr.getallresponseheaders()); } });
the jqxhr.getallresponseheaders()
output on dev machine that:
date: fri, 05 aug 2011 01:29:20 gmt server: ... x-powered-by: ... content-length: 5 keep-alive: timeout=15, max=98 connection: keep-alive content-type: text/html
the keep-alive: timeout=15, max=98
worth have deeper at. no redirect result in max=99
while 1 redirect results in max=98
Comments
Post a Comment