Skip to content

Instantly share code, notes, and snippets.

@netsi1964
Last active December 27, 2018 01:52
Show Gist options
  • Save netsi1964/4117740 to your computer and use it in GitHub Desktop.
Save netsi1964/4117740 to your computer and use it in GitHub Desktop.
Bookmarklet:Open window with cookie information
!function(){var t="Click to read information about this cookie",e="Cookies found on "+document.location.host,o="<style>body{font-family: monospace ;}</style><h1>"+e+"</h1><table><thead><tr><td>Name</td><td>Value</td></tr></thead><tbody>",a=document.cookie||"",a=a.split(";"),i="";[].forEach.call(a,function(e){var o=e.split("=");try{na=o[0].replace(/\s/gi,""),va=o[1].replace(/\s/gi,""),i+='<tr><td><a href="http://google.com/?q='+na+'" target="_blank" title="'+t+'">'+na+"</a></td><td>"+va+"</td></tr>"}catch(a){}}),0===i.length?alert("No cookies found"):(i+="</tbody></table>",w=window.open(""),setTimeout(function(){w.document.title=e},1e3),w.document.write(o+i+'<h2>Original</h2><textarea style="width: 100%; height: 100px;">'+document.cookie+"</textarea>"))}();
(function() {
var t = 'Click to read information about this cookie',
ti = 'Cookies found on ' + document.location.host,
s = '<style>body{font-family: monospace ;}</style><h1>' + ti + '</h1><table><thead><tr><td>Name</td><td>Value</td></tr></thead><tbody>',
c = document.cookie || "",
c = c.split(";"),
f = "";
[].forEach.call(c, function(e) {
var v = e.split('=');
try {
na = v[0].replace(/\s/ig, ''), va = v[1].replace(/\s/ig, ''), f += '<tr><td><a href="http://google.com/?q=' + na + '" target="_blank" title="' + t + '">' + na + '</a></td><td>' + va + '</td></tr>';
} catch (ee) {};
});
if (f.length === 0) {
alert("No cookies found");
} else {
f += '</tbody></table>', w = window.open('');
setTimeout(function() {
w.document.title = ti;
}, 1000);
w.document.write(s + f + '<h2>Original</h2><textarea style="width: 100%; height: 100px;">' + document.cookie + '</textarea>');
}
})();
@netsi1964
Copy link
Author

This bookmarklet will open a window (disable popup to see) containing a list of cookies on the current site.
Drag me to bookmark line

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment