Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
94
rated 0 times [  96] [ 2]  / answers: 1 / hits: 194551  / 14 Years ago, tue, august 3, 2010, 12:00:00

Is there any way to, with help of Javascript, list all cookies associated with the current page? That is, if I don't know the names of the cookies but want to retrieve all the information they contain.


More From » cookies

 Answers
67

You can list cookies for current domain:



function listCookies() {
var theCookies = document.cookie.split(';');
var aString = '';
for (var i = 1 ; i <= theCookies.length; i++) {
aString += i + ' ' + theCookies[i-1] + n;
}
return aString;
}


But you cannot list cookies for other domains for security reasons


[#96029] Monday, August 2, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
mari

Total Points: 305
Total Questions: 100
Total Answers: 98

Location: Somalia
Member since Mon, Feb 27, 2023
1 Year ago
;