Matthew Steven Kelly

First page visit test

March31

This page displays the first time any page on www.matthewstevenkelly.com is visited, when the below code is enabled. I have it disabled right now, but if you would like to create a landing page on your site using javascript, simple add the code below to your page <head> and replace the url= with your sites landing page. You can enable this on an entire site by adding it to the <head> of every page, or just add it to a single page. It uses cookies to detect if the site has been visited before.

<script language=”Javascript” type=”text/javascript”>
<!–
function GetCookie(name) {
var arg=name+”=”;
var alen=arg.length;
var clen=document.cookie.length;
var i=0;
while (i<clen) {
var j=i+alen;
if (document.cookie.substring(i,j)==arg)
return “here”;
i=document.cookie.indexOf(” “,i)+1;
if (i==0) break;
}
return null;
}
var visit=GetCookie(“COOKIE1″);
if (visit==null){
var expire=new Date()+60*60*24*30;
document.cookie=”COOKIE1=here; expires=”+expire;
url = “http://www.matthewstevenkelly.com/blog/random/first-page-visit-test.html”;
if(document.referrer!=url){window.location = url;}
}
// –>
</script>

posted under Random
«
»


  1. On March 31st, 2012 at 3:46 pm Bill Conner Says:

    My message

  2. On March 31st, 2012 at 3:47 pm Bill Conner 1 Says:

    Testing again

  3. On March 31st, 2012 at 3:49 pm Bill Conner 1 Says:

    Now is the time