Is it possible to write a page that open my site and show my cookie for the site? For example, open mysite.com and alert me my cookie at mysite.com.
Thanks in advance.
Is it possible to write a page that open my site and show my cookie for the site? For example, open mysite.com and alert me my cookie at mysite.com.
Thanks in advance.
document.cookie
in JavaScript contains all the cookies of the current document. So, you can easily alert that, or write it somewhere in your page. So, a simple answer could be:
window.onload = function(){
var cookiesString = document.cookie;
document.write("<div>" + cookieString + "</div>");
};
ar = document.cookie.replace(/;/g,"<br/>");
document.body.innerHTML += "<div style='background:white;position:fixed;top:0;'>"+unescape(ar)+"</div>";
you can add a "javascript:" and use it as a bookmark; add a new bookmark and set the location to :
javascript:var ar = document.cookie.replace(/;/g,"<br/>");document.body.innerHTML += "<div style='background:white;position:fixed;top:0;'>"+unescape(ar)+"</div>";