Skip to content Skip to sidebar Skip to footer

Javascript Countdown And Redirect

I have a javascript script that runs a countdown and then redirects to a different link. Since I now have all my sites running off the same code using a static domain, I would like

Solution 1:

window.location.replace("http://mydomainhere.com");

This is really the only important line. Instead of using a span tag, I'd just stick a hidden element on the page.

<input id="url" type="hidden" value="http://www.adomain.com"/>

Then you grab the value:

var url = document.getElementById("url").getAttribute("value");

window.location.replace(url);

Post a Comment for "Javascript Countdown And Redirect"