Created
May 22, 2012 16:59
-
-
Save apphp-snippets/2770263 to your computer and use it in GitHub Desktop.
You can use JavaScript window.location to redirect a visitor to a required page. You may have seen this feature used by sites with full page ads, or to redirect visitors to the site's new domain name. You can add also a timer to the script that will allow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script type="text/javascript"> | |
| /* Source: http://www.apphp.com/index.php?snippet=php-get-remote-ip-address */ | |
| var count = 6; | |
| var redirect = "http://www.apphp.com"; | |
| function countDown(){ | |
| var timer = document.getElementById("timer"); | |
| if(count > 0){ | |
| count--; | |
| timer.innerHTML = "This page will redirect in "+count+" seconds."; | |
| setTimeout("countDown()", 1000); | |
| }else{ | |
| window.location.href = redirect; | |
| } | |
| } | |
| 15. | |
| </script> | |
| Our webpage has beed moved. Please update your bookmarks for the new site. | |
| <br> | |
| <span id="timer"> | |
| <script type="text/javascript">countDown();</script> | |
| </span> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment