Get request url from xhr object

前端 未结 6 1678
闹比i
闹比i 2020-12-03 04:31

Is there any way to extract the request url from an xhr object? I can see the url in firebug via the channel property but you cant query this using javascript.

6条回答
  •  渐次进展
    2020-12-03 04:52

    According to https://developer.mozilla.org/en/XmlHttpRequest, you can indeed get channel if you have elevated privileges; however, channel is non-standard (might not work in other browsers), and indeed the W3C specs at http://www.w3.org/TR/XMLHttpRequest/ do not mention channel nor any other way to "extract the request URL". I suspect, therefore, that there is no way to do so reasonably across browsers.

提交回复
热议问题