Skip to content Skip to sidebar Skip to footer

Cannot Delete Urls With Chrome's History Api

I am making a Chrome extension to remove certain URLs from my history, using Chrome's history API. Here is the code so far: document.addEventListener('DOMContentLoaded', function()

Solution 1:

You should not pass a string to the chrome.history.deleteUrl method, but an object with key url. If you inspect your popup, you would see the following error:

Error: Invocation of form history.deleteUrl(string) doesn't match definition history.deleteUrl(object details, optional function callback)

In summary, change

chrome.history.deleteUrl(query.value)

to

chrome.history.deleteUrl({ url: query.value });

Post a Comment for "Cannot Delete Urls With Chrome's History Api"