A bookmarklet to set cookies in a page
September 01, 2008 02:19:31 Last update: May 23, 2009 16:50:10
Use this bookmarklet to set or delete cookies in a web page. If you leave the expires date as is, the cookie will be deleted. Add this link to your bookmarks to install the bookmarklet.
<html> <body> <a href="javascript:if (!window.hhhgewrt34frdkk) { window.hhhgewrt34frdkk=1; function e$x(s) { return document.getElementById(s); } function $setCookie() { document.cookie=e$x('$cname').value + '=' + escape(e$x('$cvalue').value) + ';' + (e$x('$cdomain').value ? 'domain=' + e$x('$cdomain').value + ';' : '') + (e$x('$cpath').value ? 'path=' + e$x('$cpath').value + ';' : '') + (e$x('$cexpires').value ? 'expires=' + e$x('$cexpires').value + ';' : ''); dismiss$y(); } function dismiss$y() { document.body.removeChild($y); window.onscroll = oldscroll; window.hhhgewrt34frdkk = null; }; $y = document.createElement('DIV'); $y.style.cssText = 'position:absolute;border:1px solid #85A4E6;display:block;color:black;background:#FFF;z-index:1000000;height:auto;width:auto'; document.body.appendChild($y); oldscroll = window.onscroll; window.onscroll = function() { $y.style.top = (document.body.scrollTop || document.documentElement.scrollTop) + 5 + 'px'; if (oldscroll) { oldscroll(); } }; $ctb = '<table cellspacing=\'0\' cellpadding=\'4\' style=\'background:#FFF;font-family:sans-serif;font-size:0.9em;margin:0;padding:0\'>' + '<tr><th colspan=\'2\' style=\'background:#85A4E6;color:#FFF;\'><div style=\'display:block;float:right;cursor:pointer;width:auto\' onclick=\'dismiss$y();\'>x</div>Set Cookie</th></tr>' +'<tr><td>Name:</td><td><input id=\'$cname\' size=\'30\'/></td></tr>' +'<tr><td>Value:</td><td><input id=\'$cvalue\' size=\'30\'/></td></tr>' +'<tr><td>Domain:</td><td><input id=\'$cdomain\' size=\'30\'/></td></tr>' +'<tr><td>Path:</td><td><input id=\'$cpath\' size=\'30\'/></td></tr>' +'<tr><td>Expires:</td><td><input id=\'$cexpires\' value=\'Fri, 21 Dec 1976 04:31:24 GMT\' size=\'30\'/></td></tr>' +'<tr><td colspan=\'2\' align=\'right\'><button onclick=\'$setCookie();\'>Set</button></td></tr>' +'</table>'; $y.innerHTML = $ctb; $y.style.top = (document.body.scrollTop || document.documentElement.scrollTop) + 5 + 'px'; $y.style.left = '5px'; void(x=3); } ">Set Cookie</a> </body> </html>