javascript - CountDown Timer Before Redirect In Pure PHP -
i using pure javascript count down timer shared below redirect url after time , show left time visitor also.
demo: jsfiddle
<form name="redirect" id="redirect"> redirected next page after <input size="1" name="redirect2" id="counter"></input>seconds. </form> <script type="text/javascript"> var countdownfrom=5 var currentsecond=document.redirect.redirect2.value=countdownfrom+1 function countredirect(){ if (currentsecond!=0){ currentsecond-=1 document.redirect.redirect2.value=currentsecond } else{ showit() return } settimeout("countredirect()",1000) } countredirect() function showit() { window.location.href = "http://jsfiddle.net/"; } </script>
now want same function , features , work in pure php know many old mobile browsers still does't not support javascript , many using javascript blocker. possible same in pure php
, no <script>
tags.
update:
i know below codes want count down timer show visitor.
<?php header('refresh: 5; url=http://jsfiddle.net/'); ?>
<meta http-equiv="refresh" content="5;url=http://jsfiddle.net/">
answer:
this can't done php need use jquery or javascript it. php server side scripting language have use client side language task.
tip:
for redirecting purpose use header()
function in php redirect php file in time.your code should this
<?php header( "refresh:5;url=http://jsfiddle.net" ); ?>
hope helps you...
Comments
Post a Comment