code snippet not working on my page
-
Hi PHP snippet team,
I am trying to use a code snippet with auto forward url script but its not working while adding the snippet short code on a page. After 45 seconds the page shall be auto-forward to a specific URL.
Screenshots:
Page with shortcode: https://www.screencast.com/t/13YqWfvM9CA
PHP Snippent: https://www.screencast.com/t/itkPL0IvO57U and https://www.screencast.com/t/MRoZD7mOV5
Code:<p><!-- Modify this according to your requirement – core script and suffix grabbing --></p> <h3 style="text-align: center;"><span style="color: #ffffff; background-color: #039e00;">►Auto-redirecting after <span id="countdown">45</span> seconds◄</span></h3> <p><!-- JavaScript part --><br /><script type="text/javascript"> function findGetParameter(parameterName) { var result = null, tmp = []; location.search .substr(1) .split("&") .forEach(function (item) { tmp = item.split("="); if (tmp[0] === parameterName) result = decodeURIComponent(tmp[1]); }); return result; } // Total seconds to wait var seconds = 45; function countdown() { seconds = seconds - 1; if (seconds < 0) { // Chnage your redirection link here var tid = findGetParameter('tid'); window.location = "https://google.com" + '?tid='+tid; } else { // Update remaining seconds document.getElementById("countdown").innerHTML = seconds; // Count down using javascript window.setTimeout("countdown()", 1000); } } // Run countdown function countdown(); </script></p>I am looking forward on your advice.
Best, Alex
The page I need help with: [log in to see the link]
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘code snippet not working on my page’ is closed to new replies.