redirect error page 404 with Javascript

-1

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

I'll simplify the problem a bit.

  

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

    
asked by anonymous 25.05.2016 / 00:16

1 answer

2

You can use setTimeout and redirect to index.html .

On page 404, include this script:

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