使用Chrome开发工具查找XMLHttpRequest的来源

Ste*_*ett 34 javascript debugging xmlhttprequest google-chrome-devtools

我正在尝试调试一个不是我编写的Web应用程序.发生了一个失败的XMLHttpRequest:

XMLHttpRequest cannot load ... No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '...' is therefore not allowed access. 
Run Code Online (Sandbox Code Playgroud)

有没有办法,最好使用Chrome开发者工具,找到这个电话的来源?

Ste*_*ett 56

事实证明 - 是的,有.我一直忽略的那个"XHR断点"选项:

在此输入图像描述

它完美地运作.

  • 它会阻止你进行XHR调用而不是真正的功能,因为按住"Shift + F11"退出函数调用直到你到达开始. (8认同)
  • 天啊,我怎么错过了这个功能. (4认同)