Skip to content Skip to sidebar Skip to footer

Accessing A Cookie's Value Through The Address Bar

Let's say that a user on my site has a cookie from another site and I know the cookie's name. Basically what I am trying to do is to give users a link to the address bar, and with

Solution 1:

Before the days of Firebug and other browser development tools, I used to type the following into the URL bar to see the sites cookies:

javascript:alert(document.cookie)

So, I just went to google.com, then tried this with Firefox 19, Chrome 26 and Safari 6 on my Mac (OS X 10.8).

Chrome let me type javascript:alert(document.cookie), but when I paste it into the URL bar, it stripped the javascript: and just pasted alert(document.cookie), which ran a google search.

Safari alerted the cookies on paste, but Firefox would not allow pasting, nor typing.

Those results were direct user input, and had mixed results. With a link from another site, and all the "cross domain" security issues, this is not going to work. If you think of it, this is really another form of a Cross-site scripting (XSS) attack.

Post a Comment for "Accessing A Cookie's Value Through The Address Bar"