有没有办法看到由XMLHtt prequest检索最终的URL? [英] Is there a way to see the final URL retrieved by an XMLHttpRequest?

查看:168
本文介绍了有没有办法看到由XMLHtt prequest检索最终的URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我这样做,将被重定向到一个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!). :)

这篇关于有没有办法看到由XMLHtt prequest检索最终的URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆