I use an ajax head request to check for a file.
In most cases the file wouldn’t exist and it would be nice to somehow prevent the 404 to show up in my debug console. Is there a nice way to achieve that?
Just to be clear: http://jsfiddle.net/kannix/FFLdP/
No, unfortunately, you cannot.
404 errors are handled internally, you cannot suppress the error, not even with overwriting the error events in javascript or try-catching it.
You could write a serverscript to check if a certain file exists and call that one to check if the file exists before calling the file that might not exist.