简体   繁体   中英

Getting Cookie for a website for a User

Is it possible to search a web page's cookie files for the cookies corresponding to a particular user? For Example, given any of the functions defined here , I hope to be able to pass in a website URL and a name and function returns the cookie for that user(if any); All this happening when I run the script.

Or, how can I get the username from the cookies collected?

Also, When I run commands like document.cookie, it returns a dialog with some variables and values. Variable like localle, c_user, csm, sub, act, etc... What is the meaning of these variables? Is it possible to uniquely identify a cookie given the a username?

JavaScript, when embedded in an HTML document, has access to the cookies the browser has set for that page.

It cannot access cookies for a different page (unless the cookie is shared between them).

It cannot access cookies for other browsers (since the cookies are not stored in the browser running the JS).

Update re edit (which, BTW, should have been a new question):

document.cookie gives you a string containing the cookies for the document. The cookie names are determined by the author of the code that set them. They mean whatever that person wants them to mean.

Cookies can be identified by their name. Cookies do not have usernames (although the author of the code that set the cookie might store a username in a cookie).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM