有没有办法看到由XMLHtt prequest检索最终的URL?没有办法、XMLHtt、URL、prequest

由网友(别跟我磨叽i)分享简介:我这样做,将被重定向到一个AJAX下载。我想知道的请求被重定向到最终的目标URL。我使用jQuery,但也有机会获得潜在的XMLHtt prequest。有谁知道一种方式来获得最后的网址是什么?I'm doing an AJAX download that is being redirected. I'd like...

我这样做,将被重定向到一个AJAX下载。我想知道的请求被重定向到最终的目标URL。我使用jQuery,但也有机会获得潜在的XMLHtt prequest。有谁知道一种方式来获得最后的网址是什么?

I'm doing an AJAX download that is being redirected. I'd like to know the final target URL the request was redirected to. I'm using jQuery, but also have access to the underlying XMLHttpRequest. Does anyone know a way to get the final URL?

好像我就需要有最终的目标插入其网址在标题或响应体已知位置,然后让脚本寻找它。我希望有东西,将工作目标,无论虽然。

It seems like I'll need to have the final target insert its URL into a known location in the headers or response body, then have the script look for it there. I was hoping to have something that would work regardless of the target though.

附加说明:我在问我怎么code可以从生产code完整的URL,这将在用户的系统上运行。我不要求我怎样才能当我调试的完整URL。

Additional note: I'm asking how my code can get the full url from production code, which will run from the user's system. I'm not asking how I can get the full url when I'm debugging.

推荐答案

我将第二Firebug的建议。你会看到URL作为HTTP响应位置标头。 这听起来像你还想要得到的网址,JS?如果是这样,你可以得到它的回调XHR响应对象(你也可以检查使用FB!)。 :)

I'll second the Firebug suggestion. You'll see the url as the "Location" header in the http response. It sounds like you also want to get this url in js? If so, you can get it off the xhr response object in the callback (which you can also inspect using FB!). :)

阅读全文

相关推荐

最新文章