Let's say that I got a cookie just from browsing a website(which I do not own), and I know the cookie's name. Now let's say I am on that website, going over to the address bar. My question is: Would I be able to display the value of that cookie after entering some sort of Javascript Code? or Any other code?
It's kinda Important for me to learn right now as I am studying websites. (And I know that I can get the cookies value with "Cookie Editor" and etc. I am just trying to get it through the address bar too).
javascript:alert(document.cookie);
in Chrome's address bar works fine for me (it'll list all cookies for the current document). Note that for security reasons you have to type, not paste, the javascript:
part.
Most browsers can just show you the value of cookies for all sites you've visited (including the current one). So, it's probably just easier to examine the cookie values there. I know Firefox has a full built-in UI for displaying all the cookies for a given domain. I suspect Chrome does too, but I'll have to look for that now to see if I can find it.
In Chrome, you go to:
Settings
Show Advanced Settings
Privacy/Content Settings...
All Cookies and Site Data...
Click on a Domain
Click on a cookie name
See the value for that cookie name
Other than using the address bar you might want to look at the JavaScript console (CTRL+SHIFT+J for PC, I'm not sure about Apple). You can write JavaScript expressions there without having to use window.alert()
etc.
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.