How can I easily delete many items at once from the Chrome history? [duplicate]

I want to remove a large number of specific items from the Chrome history.

I can search for my term, but then I have to click a lot of checkboxes just to remove every item. Is there a way to make this process faster?


You can also Shift+Click to select multiple items in history and remove them at once.

This works as of Chrome version 33, and possibly earlier versions.

  1. Perform a search to bring up the relevant history items
  2. Click the first result
  3. Shift+Click the last result
  4. Click Remove Selected Items

  1. Perform a search to bring up the items you want to remove the history.

    enter image description here

  2. Open the Chrome Developer Tools console by pressing Ctrl+Shift+J.

  3. Make sure to select the history-frame frame as the target frame for the console.

    enter image description here

  4. Execute the following snippet in the console (by pasting it and pressing Enter) to mark all checkboxes in the history.

    var checkboxes = $$( "input[type='checkbox']" );
    for( var i = 0; i < checkboxes.length; ++i ) {
      checkboxes[ i ].checked = true;
    }
    

    Don't forget to double-check the selection and uncheck items which you don't actually want to remove!

  5. Clear the selected items from your history by pressing the Remove selected items.

    enter image description here


Here's something I wrote in JavaScript.. It works through the Console Debugger.. I tried using it in a bookmark but I get no response from the page..

** // UPDATE (07.28.15)
I added a shorter approach provided by @Denis Gorbachev to the checkbox targeting, which helped shorten some of this code. I also added "auto-stop" functionality, meaning the loop will stop once it has finally cleared the list.

** // UPDATE (08.20.14)
I made a few changes to the code, to make it more user friendly. Other users may not be code-savvy, and others may simply prefer convenience. Therefore, I whipped up a couple buttons (start/stop) to control the usage; as well as address some "ASSERTION FAILED" exceptions/errors that were being thrown when attempted to run the script loop.. Enjoy!!


Step 1) In your address bar, type in the following address to to the meat of the history page.. It's normally loaded in an iframe, with the left-side menu loaded in another frame..

chrome://history-frame/

Step 2) Load your Console Debugger/Viewer by pressing Ctrl+Shift+J
(For Mac users, ++J)
                Note: You can also press F12 and select the "Console" tab.

Step 3) In the Console Debugger/Viewer, copy & paste the following code:

function removeItems() {
removeButton = document.getElementById('remove-selected');
overlayWindow = document.getElementById('overlay');
    //revision (07.28.15): Replaced the For Loop targeting the checkboxes, thanks to Denis Gorbachev via comments (02.19.15)
Array.prototype.forEach.call(document.querySelectorAll("input[type=checkbox]"), function(node) {node.checked = "checked"});
setTimeout(function () {
    if (removeButton.getAttribute("disabled") !== null) {
        removeButton.removeAttribute("disabled")
    }
    /* revision (08.20.14): no longer binding to that condition, button should no longer be disabled, so click! */
    if ((overlayWindow.hasAttribute("hidden")) && (overlayWindow.getAttribute("hidden") !== false)) {
        removeButton.click();
    }
    /* revision (08.20.14): new Interval, to check against the overlay DIV containing the confirmation "Remove" button */
    /* Attempting to click the button while the DIV's "hidden" attribute is in effect will cause FAILED ASSERTION */
    stopButton = setInterval(function () {
        if (overlayWindow.hasAttribute("hidden")) {
            if (overlayWindow.getAttribute("hidden") == "false") {
                hidden = false
            } else {
                hidden = true
            }
        } else {
            hidden = false
        }
        if (!hidden) {
            document.getElementById("alertOverlayOk").click();
            clearInterval(stopButton)
        }
    }, 250)
}, 250)
}
//revision (08.20.14): Lets build our buttons to control this so we no longer need the console
//stop button (08.20.14)
var stopButton = document.createElement('button');
stopButton.setAttribute('id', "stopButton");
stopButton.innerHTML = "Stop";
stopButton.style.background = "#800";
stopButton.style.color = "#fff";
stopButton.style.display = "none";
stopButton.onclick = function () {
    clearInterval(window.clearAllFiltered);
    document.getElementById("stopButton").style.display = "none";
    document.getElementById("startButton").style.display = ""
};
//start button (08.20.14)
var startButton = document.createElement('button');
startButton.setAttribute('id', "startButton");
startButton.innerHTML = "Start";
startButton.style.background = "#090";
startButton.style.color = "#fff";
startButton.onclick = function () {
    window.clearAllFiltered = setInterval(function () {
/* revision (07.28.15): Stop the Loop automatically if there are no more items to remove */
        if(document.getElementById("results-header").innerText=="No search results found."){
            document.getElementById("stopButton").click();
            }
        if (document.getElementById("loading-spinner").getAttribute("hidden") !== null) {
            removeItems()
        }
    }, 250); //adjust Time Here (1500 [millisec] = 1.5sec)
    document.getElementById("stopButton").style.display = "";
    document.getElementById("startButton").style.display = "none"
};
/* revision (08.20.14): Now we add our buttons, and we're ready to go! */
editingControls = document.getElementById('editing-controls');
editingControls.appendChild(stopButton);
editingControls.appendChild(startButton);

This removeItems function will select loop through all form inputs and check all checkboxes, enable the "Remove Selected Items" button and click it. After a half-second, it'll check if the "Are You Sure" prompt is displayed and, if so, click the "Yes/Remove" button automatically for you so that it will load a new list of items to do this process all over again..

The item is looped using the variable "clearAllFiltered", which is a setInterval loop, which is checking for the status of the "Loading" screen..

To start erasing your filtered history items, you can now click the green Start button.

** // UPDATE (07.28.2015) It will now stop on ITS OWN.

To stop the loop manually, you can now click the red Stop button. Simple as that!