javascript Chrome 扩展无法读取 httponly cookie [英] javascript Chrome Extension Not able to read httponly cookies

查看:97
本文介绍了javascript Chrome 扩展无法读取 httponly cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用 chrome 扩展删除在我的 chrome 浏览器中设置的 gmail cookie,但它可以删除除 Gmail cookie 之外的所有 cookie,然后我注意到 Gmail cookie 是 httponly,有没有办法使用 javascript chrome 扩展删除它们..

I need to delete gmail cookies set in my chrome browser, using chrome extension , but it can delete all cookies other then Gmail cookies, then I noticed that Gmail cookies are httponly, Is there a way to remove them using javascript chrome extension..

谢谢:)

推荐答案

这个对于删除每个 cookie 都非常有效,即使它是 httponly

This one works absolutely fine for deleting every cookie, even if it is httponly

chrome.cookies.getAll({'domain':'accounts.google.com'},function(cookie){ 

    for(i=0;i<cookie.length;i++){

    var prefix = "https://";

    var url =  prefix + cookie[i].domain + cookie[i].path;

    chrome.cookies.remove({'url':url , 'name':cookie[i].name},function(cookie){ });             
    }       
 }); 

这篇关于javascript Chrome 扩展无法读取 httponly cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆