Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check if file exists but prevent 404 error in console from showing up [duplicate]

Tags:

javascript

Is it possible to check to see if a file/page exists via JavaScript but prevent the 404 Error from showing up in the console?

like image 232
Muers Avatar asked Aug 12 '11 04:08

Muers


People also ask

How do I get rid of 404 File or directory not found?

The simplest and easiest way to fix your 404 error code is to redirect the page to another one. You can perform this task using a 301 redirect. What's 301, you may ask? It's a redirect response code that signals a browser that the content has been transferred to another URL.

Why does 404 keep appearing?

You might see a 404 error because of a problem with the website, because the page was moved or deleted, or because you typed the URL wrong. 404 errors are less common today than they used to be, as websites now strive to automatically redirect visitors away from deleted pages.


1 Answers

Seems like the answer is: No. Can't avoid getting a 404 error in the console unless you kick off a call to a server-side script to check file existence.

like image 78
Muers Avatar answered Sep 19 '22 12:09

Muers