我可以阻止Chrome开发者工具控制台记录图像404错误吗? [英] Can I prevent the Chrome Developer Tools console from logging image 404 errors?

查看:758
本文介绍了我可以阻止Chrome开发者工具控制台记录图像404错误吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次找不到页面资源(包括图片)时,Chrome开发者工具控制台都会记录错误(即返回404)。

The Chrome Developer Tools console logs an error each time a page asset (including an image) isn't found (i.e. returns 404).

在我的工作中,我经常在第三方提供图像的网站上工作,在开发过程中可能无法使用。将每个丢失的图像显示为控制台中的错误会使其他更重要的错误(例如JavaScript错误)更难注意到。

In my work, I'm often working on sites where images are provided by third parties and may not be available during development. Having each missing image show up as an error in the console makes other more important errors (e.g. JavaScript errors) harder to notice.

是否存在停止控制台记录的设置将图像视为错误?

Is there a setting that stops the console logging unfound images as errors?

或者是否有某种方法可以按照您可以在网络标签中过滤请求的相同标准来过滤控制台消息?

Or is there some way to filter console messages by the same sort of criteria that you can filter requests by in the Network tab?

(参见例如 http://chromium.googlecode.com/issues/attachment?aid=1337330000000&name=Screenshot-Google%2B+-+Google+Chrome.png&token=1F05er8uKjAQEEBrUITFjsIGJ2A% 3A1358867878658& inline = 1

推荐答案

Chromium团队已经开始工作: https://code.google.com/p/chromium/issues / detail?id = 96212

Work has "started" on this by the Chromium team: https://code.google.com/p/chromium/issues/detail?id=96212

更新:此功能请求已于2013年3月18日关闭。我不确定该功能首次出现在哪个版本的Chrome中,但我可以在Chrome v33.0.1750.152(Linux)中确认控制台过滤选项。

Update: The feature request was closed on March 18, 2013. I'm not sure in which version of Chrome this feature first appeared, but I can confirm console filtering options in my Chrome v33.0.1750.152 (Linux).

更新2: 目前,当输入过滤器(纯文本或正则表达式)时,将根据消息文本对其进行测试(例如, 获取http://example.com/foobar 404(未找到))以及右侧链接的文本(例如 test.html :65 )。 (我已向Chromium提交问题以跟踪此情况。)

Update 2: Currently, when a filter (plain text or regular expression) is entered, it is tested against the message text (e.g. GET http://example.com/foobar 404 (Not Found)) as well as the text of the right side link (e.g. test.html:65). (I have filed an issue with Chromium to track this.)

作为解决方法,使用正则表达式过滤器,如:

As a workaround, use a regular expression filter like:

^(?!。* 404 \\ \\(Not Found\))(?!。* [文件名])

其中 [文件名] 是来自右侧链接的文件名。

where [file name] is the file name from the right side link.

例如,如果我的页面是 test.html ,然后 ^(?!。* 404 \(Not Found\))(?!。* test\.html)将有效。

For example, if my page is test.html, then ^(?!.* 404 \(Not Found\))(?!.*test\.html) will work.

注意:这也会过滤掉消息文本中包含文件名的消息。我现在还不确定是否有办法解决这个问题。

Note: This will also filter out messages that have the file name in the message text. I'm not sure there is a way around this for now.

这篇关于我可以阻止Chrome开发者工具控制台记录图像404错误吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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