So for the past few weeks I've been trying to make myself a chrome extension that auto deletes history, I thought I was about finished, but I then realized that the chrome.history.search() doesn't return all of the history, only some and I can't figure out why certain bits of history get deleted and some don't. I currently have
`chrome.storage.sync.get({ // Retrieving the stored array of words
list: []
},
function(data) {
for (i = 0; i < data.list.length; i++) {
let searchString = data.list[i].toString(); //String that is searched for
chrome.history.search({ // History search function
text: searchString, // String to search for
startTime: 2678400000,
maxResults: 5000,
}, checkHistory)
}
});`
and my callback function is
`function checkHistory(historyItems) {
for (let item of historyItems) { // Deleting items that were found in the search
chrome.history.deleteUrl({
url: item.url
});
}
}`
My goal is so that if I search for "Google" for example, it'll delete all searches with the sub-string "Google" in them. I'm 100% sure that the list isn't the issue as it prints just fine, One thing I've noticed is that when I attempt to delete, it always deletes everything older than 2-3 days with the sub-string, I thought I'd just put it out there I'm not sure if it means anything. I would appreciate any insight on what the issue could be. Thanks!
maybe its because of the start time, find how chrome calculates its time. If it doesnt work then try the API
chrome.history.deleteRange(object range, function callback)