2012年11月22日 星期四

javascript 操作cookie

JavaScript bookmarklet to delete all cookies within a given domain
http://stackoverflow.com/questions/178263/javascript-bookmarklet-to-delete-all-cookies-within-a-given-domain
Clearing all cookies with JavaScript
http://stackoverflow.com/questions/179355/clearing-all-cookies-with-javascript

function deleteAllCookies() {
    var cookies = document.cookie.split(";");

    for (var i = 0; i < cookies.length; i++) {
     var cookie = cookies[i];
     var eqPos = cookie.indexOf("=");
     var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
     document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT";
    }
}


Get URL parameter with jQuery (用純js取get值)
http://stackoverflow.com/questions/1403888/get-url-parameter-with-jquery
function getURLParameter(name) {
    return decodeURI(
        (RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]
    );
}
JavaScript删除登录用户的所有的cookie信息的 (採用)
http://www.ityoudao.com/Web/Html_JS_646_1190.html
AJAX動態內容支援回上頁-HTML5篇
http://blog.darkthread.net/post-2011-09-23-ajax-history-in-html5.aspx
使用History ,但IE8,7,6不支援,所以ivan另裝套件讓ie支援History

沒有留言:

張貼留言