javascript - How can I display different versions of my website to the visitors randomly with the same probability? -


i have 3 different versions of website show them visitors randomly. example when first user visited webpage show version-1 of website, when second user visited webpage, show version-2, third user displays version-3 , next user version-1 again , on…

could tell me please right approach problem, javascript code put in main webpage take control of action?

using php , json file:

<?php   $arr = json_decode(file_get_contents('array.json'), true);   if(count($arr) >= 3) $arr = array();   $searching = true;   while($searching){     $page = rand(0,3);     if(!array_search($page,$arr)){       $searching = false;       array_push($arr,$page);     }   }   file_put_contents("array.json",json_encode($arr));   // page number $page ?> 

Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -