Browser Inspector how to know if image or other resources belongs to which css or js file that was failed to load?

别来无恙 提交于 2019-12-10 10:28:49

问题


I can see some images in my webpage that are not loading the reason is the wrong path inside the css or js file but how to know which js or css file is trying to load that resource. I tried too much in browser's inspector to find some way but I cannot figure out so I have to search each js and css file for the resource name. Is there any way to know the exact js or css file that is trying to load the failed resource. Thanks


回答1:


The Firefox and the Chrome DevTools provide a way to see what initiated the request of a resource within their Network panels.

Chrome DevTools

The Network panel within Chrome's DevTools provides information about the origin of a request within an Initiator column. All entries except the ones saying 'Other' link to the line within the JavaScript, CSS, or document, which caused the request.
For JavaScript calls it shows the stack trace that led to the request on hover.

It even allows you to highlight the initiators and dependencies by holding down Shift and hovering entries within the list.

Firefox DevTools

The Firefox DevTools Network Monitor has a Cause column indicating if a request came from JavaScript, the document, CSS, or some other source.

For JavaScript calls it provides the stack trace within a Stack Trace side bar when selecting the entry.

Unfortunately, for causes other than JavaScript it doesn't provide much useful information or links to the source files yet (as of Firefox 55). Therefore I've filed several enhancement requests to improve this feature.



来源:https://stackoverflow.com/questions/45879825/browser-inspector-how-to-know-if-image-or-other-resources-belongs-to-which-css-o

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!