404 detection in JavaScript

Posted by Vadim on Stack Overflow See other posts from Stack Overflow or by Vadim
Published on 2010-12-23T19:42:05Z Indexed on 2010/12/23 20:54 UTC
Read the original article Hit count: 211

Filed under:
|

In my JavaScript I'm trying to redirect to third party page. It can open a page either in a new window or inside a frame depends on a user settings. Something like this:

if (newWindow)
{
   window.open(url, targer);
}
else
{
   theFrame = url;
}

What I want to do is to display my custom page in case a third party site is down or page is unavailable. Basically in case of 404 error.

What's the best way to solve this problem?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about 404