redirect 404 error page with Javascript

Asked

Viewed 553 times

-1

I want to know how I can redirect a message from error 404 for the user. In this case I need an example script, and how to use.

I’ll simplify the problem a little.

The error 404 means that the visited site/blog url does not exist. How to redirect the error 404, and after a few seconds into the page index.html

  • 2

    Wouldn’t it just be adding the lines on the 404 page itself? I didn’t really understand the doubt.

1 answer

2

You can use the setTimeout and redirect to the index.html.

On page 404 includes this script:

<script>
   window.setTimeout(function(){ window.location = "http://www.pt.stackoverflow.com"; },3000);
</script>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.