JQuery handle / hide expected Ajax 404 error

I am using an ajax header request to validate a file. In most cases, the file will not exist, and it would be nice to somehow prevent the appearance of 404 in my debug console. Is there a good way to achieve this?

Just to be clear: http://jsfiddle.net/kannix/FFLdP/

+6
source share
1 answer

No, unfortunately, you cannot.

404 errors are handled internally; you cannot suppress an error without even overwriting the error events in javascript or trying to catch it.

You can write servercript to check if a specific file exists and call it to check if a file exists before calling a file that may not exist.

+9
source

Source: https://habr.com/ru/post/923362/


All Articles