hello expert i need script that load after x number of times let say if page load 1 to 10 time ..i want it load on 10 time and agian 1 to 9 it will not used or place any other code i want to use this lag in my body tag of page <script src="example.js"></script> if any help it will nice ..watting see reply
setup a cookie counter when the user logs in update the cookie this is in PHP but can be done in jQuery <?php if (isset($_COOKIE['pageload'])) { if (intval($_COOKIE['pageload']) > 9) { // do stuff here on 10th load setcookie('pageload', 1); } else { setcookie('pageload', intval($_COOKIE['pageload']) + 1); } } else { setcookie('pageload', 1); } ?>
hey thanks your Reply cadsii i am not expert in html and php codes i am just creating this code of my own site . that code u have give me ..i am not able to understand it . Let me explain to you again please do reply Full codes so i able to understand it Basically i need To Run 2 scripts it will be in jquery Let put name A and B Like <script src="jqueryscriptA.js"></script> and <script src="jqueryscriptB.js"></script> it will but in Under body tag <Body></Body> When web page load for 10 times in user PC( it can use cookie method as above cadsii is telling ) or page load counter will best in between 1 to 9 load script A should work at 10 page load script B work at that time ..and agian when 1 to 9 .. i think it will clear to All web masters Please reply with All codes because i am not expert but i am trying to learn it
dont forget to show appreciation for my answers <?php if (isset($_COOKIE['pageload'])) { if (intval($_COOKIE['pageload']) > 9) { // do stuff here on 10th load echo '<script src="jqueryscriptA.js"></script>'; setcookie('pageload', 1); } else { echo '<script src="jqueryscriptB.js"></script>'; setcookie('pageload', intval($_COOKIE['pageload']) + 1); } } else { setcookie('pageload', 1); } ?> if you have php access just dump it into any php file in between the body, but it can be in the header as well
Hello i have try your code but i am getting in my site Warning: Cannot modify header information - headers already sent by (output started at at end it say on line 11 Code (markup): i have try to put in site in head like <script src="file.php"></script>