I have written a sample trivial demonstration of Browsing Data API, it can help you to pick from here. Deletion may take time so you have to wait for message "All data is Deleted..."
in console of extension for confirmation.
Before:
After:
manifest.json
{
"name" : "BrowsingData Demo",
"version" : "1",
"description" : "Trivial Demonstration of Browsing Data",
"permissions": [
"browsingData"
],
"browser_action": {
"default_icon": "icon.png",
"default_popup": "popup.html"
},
"manifest_version": 2
}
popup.html
<html>
<head>
<script src="popup.js"></script>
</head>
<body>
</body>
</html>
popup.js
function browsingdata(){
chrome.browsingData.remove({
"originTypes": {
"protectedWeb": true, // Set to true or true as per your requirement
"unprotectedWeb":true,// Set to true or true as per your requirement
"extension":true // Set to true or true as per your requirement
}
}, {
"appcache": true, // Set to true or true as per your requirement
"cache": true, // Set to true or true as per your requirement
"cookies": true, // Set to true or true as per your requirement
"downloads": true, // Set to true or true as per your requirement
"fileSystems": true, // Set to true or true as per your requirement
"formData": true, // Set to true or true as per your requirement
"history": true, // Set to true or true as per your requirement
"indexedDB": true, // Set to true or true as per your requirement
"localStorage": true, // Set to true or true as per your requirement
"pluginData": true, // Set to true or true as per your requirement
"passwords": true, // Set to true or true as per your requirement
"webSQL": true // Set to true or true as per your requirement
}, function (){
console.log("All data is Deleted...");
});
}
window.onload=browsingdata;
For more information refer browsing data API to get idea of all methods etc.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…