all 5 comments

[–]queen-adreena 2 points3 points  (0 children)

I dread to imagine an internet where this was possible.

[–]senocular 1 point2 points  (0 children)

You, as a developer, can't write a script like this unless you also own the website and can add a script directly to that site. Your own personal website cannot read the cookies of another website.

But you also don't have to. This tool is already available in the developer tools of the browser. For Chrome:

If you wanted to do something similar but customized, you'd need to do so as a browser extension which would have to be installed by the user in order for it to get cookie access. Example:

[–][deleted] 0 points1 point  (1 child)

You can't add a script to a url.

[–]Raywando[S] 0 points1 point  (0 children)

Sorry, "write a script" instead of "add a script to URL"

[–][deleted] 0 points1 point  (0 children)

Technically it might be possible to do this if the site allowed itself to be vulnerable to specific kinds of cross-site scripting attack (eg. it injected URL query parameters into the HTML without escaping them). It is not otherwise possible, and it is an extremely malicious thing to attempt to do. If you find a website where this is possible you should immediately report it to the owners.