SOLVED: How To Redirect a Web Page After A Time Period

We had a WordPress site we were shutting down (www.ElectricCadi.com) and needed to redirect visitors to the new site (www.PartisanIssues.com).  However, we did not want to just bump people to the new site.  We wanted visitors to the old site to see an alert page telling them what we were doing before we performed the redirection.

To make this happen we used the following script:

<script>
//redirect to www.PartisanIssuses.com new site after 6 second delay
setTimeout(function () {
//Redirect with JavaScript
window.location.href= 'https://www.PartisanIssues.com/';
}, 6000);
</script>

The key was to redirect all visitors to a single page on the old site and then to embed this code into that single page.

This script can be added to HTML, WordPress, ASP, Joomla or virtually any other type of page.

 

Published by
Ian Matthews

This website uses cookies.