javascript - Redirect a page for a specific time peroid -
i trying create 302 redirect waits 18 seconds after redirecting , goes parent page.
here have done,
<script type='text/javascript'> (function (){ if (document.cookie.indexof(welcomecookie) != -1 || document.cookie.indexof(dailywelcomecookie) != -1 ){ document.cookie="tourl"+ "=" +escape(document.url)+";path=/; domain=.forbes.com"; document.cookie="refurl"+ "=" +escape(document.referrer)+";path=/; domain=.forbes.com"; this.location="http://www.forbes.com/fdc/welcome_mjx.shtml"; })(); </script>
it sounds me need first redirect user, appear know how do. however, 1 time user redirected target page, target page need have javascript send user parent page. here's simple javascript code need based on code above:
<script type='text/javascript'> (function (){ if (document.cookie.indexof(welcomecookie) != -1 || document.cookie.indexof(dailywelcomecookie) != -1 ){ document.cookie="tourl"+ "=" +escape(document.url)+";path=/; domain=.forbes.com"; document.cookie="refurl"+ "=" +escape(document.referrer)+";path=/; domain=.forbes.com"; // wait 18 seconds go specified page. 18000 milliseconds == 18 seconds settimeout(function(){ this.location="http://www.forbes.com/fdc/welcome_mjx.shtml"; }, 18000); })(); </script>
javascript
No comments:
Post a Comment