管理Google Chrome扩展程序中的Cookie [英] Manage cookies from Google Chrome Extension

查看:985
本文介绍了管理Google Chrome扩展程序中的Cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想删除Google Chrome(localhost)中储存的部分Cookie。我知道我可以从偏好访问他们,但我需要很多点击来实现这一点。我很想知道你如何管理你的饼干。

I like to delete some cookies stored in Google Chrome(localhost). I know I can access them from the preferences but I need a lot of clicks to achieve this. I would love to know how you manage your cookies. Which extension do you use?

推荐答案

这很简单, Cookie API

//delete all localhost cookies
chrome.cookies.getAll({domain: "localhost"}, function(cookies) {
    for(var i=0; i<cookies.length;i++) {
        chrome.cookies.remove({url: "http://localhost" + cookies[i].path, name: cookies[i].name});
    }
});

这篇关于管理Google Chrome扩展程序中的Cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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