Suppress “Failed to load resource: net::ERR_FILE_N

2020-04-08 01:40发布

问题:

I get the message "Failed to load resource: net::ERR_FILE_NOT_FOUND" in the console when a webview in a Chrome Packaged App tries to load a non-existent local file. This is expected, because the program is supposed to check a couple of different location, starting with the local system and then switching to a remote server as a second try.

The problem is that there are a lot of these messages in the console, which makes it very difficult to use the console for anything else.

Is there a way to turn this message off?

回答1:

Yes, you can turn this off:

Click on the filter icon at the top of the console, and tick "Hide network messages".

You can't, however, prevent this error from happening at all: it's not generated by an uncaught exception in JS but is reported from the network stack of Chrome.