【发布时间】:2016-09-08 20:44:00
【问题描述】:
我想仅在打开浏览器时自动清除历史记录和缓存,而不是在我从 chrome://extensions 重新加载扩展程序时。我该怎么做?我说的是 Chrome JavaScript API。我在 Ubuntu 16.04 上使用最新版本的 Google Chrome。
LE:我做了一个扩展,其中包括清除我的历史记录和缓存。在 manifest.json 中,我有:
"background": {"scripts": ["SessionManager.js"],"persistent":true},
在 SessionManager.js 中,我有:
function init(){
setTimeout(clean,1);
}
function clean(){
chrome.browsingData.remove({},{'appcache':true,'cache':true,'cookies':true,'downloads':true,'fileSystems':true,'formData':true,'history':true,'indexedDB':true,'localStorage':true,'serverBoundCertificates':true,'passwords':true,'pluginData':true,'serviceWorkers':true,'webSQL':true});
}
init();
【问题讨论】:
标签: javascript google-chrome google-chrome-extension