沉默网:: ERR_CONNECTION_REFUSED [英] Silence net::ERR_CONNECTION_REFUSED

查看:242
本文介绍了沉默网:: ERR_CONNECTION_REFUSED的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

连接到不存在的Web套接字服务器会导致大量错误被记录到控制台,通常是 ... net :: ERR_CONNECTION_REFUSED

Connecting to a non-existent web socket server results in loud errors being logged to the console, usually to the tune of ... net::ERR_CONNECTION_REFUSED.

任何人都有想法让hackaround沉默这个输出? XMLHttpRequest 将无效,因为如果服务器无法访问,它会产生相同的详细错误输出。

Anyone have an idea for a hackaround to silence this output? XMLHttpRequest won't work since it yields the same verbose error output if the server is not reachable.

目标这里是测试服务器是否可用,如果它是连接到它,否则使用回退,并在没有垃圾邮件控制台的情况下执行此操作。

The goal here is to test if the server is available, if it is then connect to it, otherwise use a fallback, and to do this without spamming the console with error output.

推荐答案

Chrome本身正在发出这些消息,并且无法阻止它们。这是如何构建铬的功能;每当ResourceFetcher对象尝试获取资源时,其响应都会传回其上下文,如果出现错误,浏览器会将其打印到控制台 - 请看这里

Chrome itself is emitting these messages, and there is no way to block them. This is a function of how chrome was built; whenever a ResourceFetcher object attempts to fetch a resource, its response is passed back to its context, and if there's an error, the browser prints it to the console - see here.

可以找到类似的问题其他

如果您愿意,可以使用 Chrome控制台过滤器这个问题讨论在你的控制台中阻止这些错误,但是有无法以编程方式阻止消息。

If you'd like, you can use a chrome console filter as this question discusses to block these errors in your console, but there is no way to programmatically block the messages.

这篇关于沉默网:: ERR_CONNECTION_REFUSED的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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