Recent Posts

Step One

3:17 AM No Comment
Step 1: Retrieving the Cookie or Cookies
This JavaScript can retrieve one cookie, when you know the name of the cookie. It can also retrieve all available cookies — for when you don’t know the name of the cookie or when you just want to retrieve them all.
Create a new web page to insert the JavaScript into. The JavaScript can be in the HEAD or BODY area.
No changes need to be made to this JavaScript.
<script type="text/javascript" language="JavaScript">
<!-- Copyright 2005 Bontrager Connection, LLC

function GetCookieByName(n) {
var ckcontent = '';
if(document.cookie.length < 1 || n.length < 1) { return; }
var ckname = n + '=';
var ckbegin = document.cookie.indexOf(ckname);
if(ckbegin == -1) { return; }
var ckend = 0;
ckbegin += ckname.length;
ckend = document.cookie.indexOf(";",ckbegin);
if(ckend < ckbegin) { ckend = document.cookie.length; }
ckcontent = document.cookie.substring(ckbegin,ckend);
return ckcontent;
}

function GetAllCookies() {
var ckcontent = '';
if(document.cookie.length < 1) { return; }
var allcks = document.cookie.split(';');
for(var i = 0; i < allcks.length; i++) {
     while(allcks[i].indexOf(" ") == 0) {
          allcks[i] = allcks[i].substr(1);
          }
     }
ckcontent = allcks.join("\n");
return ckcontent;
}

// —>
</script>

No comments :

 

Website | The content is copyright. © | All Rights Reserved 2011

Blogger template by PSpice