Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In Google Chrome, is it possible to delete all search history that matches a specific query (for example, en.wikipedia.org)?

share|improve this question

migrated from webapps.stackexchange.com Sep 28 '12 at 4:56

This question came from our site for power users of web applications.

    
It is possible to select all items in a search from Google Web History. I wonder if it's possible to synchronize Google Web History with Chrome's web history. –  Anderson Green Oct 22 '12 at 18:44
    
There's an extension called "Updater for Google Web History" - it appears that this extension allows Google Web History to work in Google Chrome. –  Anderson Green Oct 22 '12 at 18:53
    
check my answer no extension is needed superuser.com/a/723264/121184 –  Pooya Estakhri Mar 1 at 13:50

6 Answers 6

up vote 11 down vote accepted

thats easy

search for what you want to remove select first one now scroll to latest result press shift & choose latest one now all matches are selected and you can remove them together


another way

P.S: as Fabricio PH said here you can use javascript i've optimized his code & added some more lines Now you can use this one which works better Thx Fabricio for the basic code all user needs to do is searching for what he/she wants to remove then pasting this code in the chrome console & pressing enter then waiting and closing the page when history fully removed (for custom search or all of his/her web history)

Step 1 Since Chrome history is queried inside a iFrame, we have to visit: chrome://history-frame/ (copy and paste URL)

Step 2 Do the search query.

Step 3 Open the Chrome console(F12 or CtrlShifti or ⌘⌥i or right click and choose Inspect Element then choose Console tab ) and execute:

    function remove(){

var inputs = document.getElementsByTagName('input');
for (var i = 0; i < inputs.length; ++i) {
  if (inputs[i].type == "checkbox"){
    inputs[i].checked = true;
  }
}
document.getElementById("remove-selected").removeAttribute("disabled");
document.getElementById("remove-selected").click();
document.getElementById("alertOverlayCancel").click();
setTimeout(function(){remove();},1000);

}

setTimeout(remove(),1000);
share|improve this answer
3  
Yeah :) Plain old shift + click :) –  Mladen B. May 2 at 21:42
2  
This should be the accepted answer, please. –  Zopieux May 14 at 14:26
1  
Further information is here: superuser.com/a/747816/85129 –  Anderson Green Aug 3 at 3:30
1  
Or you can take a hacker shortcut, see my answer below ;) –  Fabricio PH Aug 4 at 14:23

It can be done, and it's not too difficult. You can even query your Chrome history using SQL. (Maybe Firefox too: see below. Of course, the appropriate file path will have to be changed).

First of all, you need to locate the Chrome History file. This is, on my system, in

C:\Documents and Settings\Leonardo Serni\Impostazioni locali\Dati applicazioni\Google\Chrome\User Data\Default

which ought to translate in a more general

<USER FOLDER>\Local Settings\Application Data\Google\Chrome\User Data\Default

In there, you will find a "History" file. It is a SQLite3 file, and to manipulate it, Chrome has to be closed. If you make a mess of it, delete the History file and start anew - it's just as if you had cleared Chrome history.

Then, rename the file to History.sqlite3 and install SQLiteMan, then open the file with SQLiteMan or any other SQLite3 utility (n.b. some utilities might not need the renaming thing. Maybe try without renaming first, to save work).

In the URLS table, you will find the URLs you have visited. For example I can run the query:

SELECT * FROM urls WHERE url LIKE '%meetup%';

to view all occurrences of 'meetup' in either the host or pathname part of the URLs I visited. Or I could search for pr0n, or... anything at all, as long as I adhere to SQL syntax.

You can even use the other information to run the query, for example the time of last visit. Only remember that you need to convert the dates to Chrome time, which is the number of microseconds elapsed from January 1st, year of our Lord 1601. On a Unix box, typing date +%s will tell you the number of seconds; multiply by one million, add 11644473600 and you're done.

For example, select visits after October 1st, 2013:

SELECT * FROM urls WHERE ((last_visit_time/1000000)-11644473600) - 
    strftime('%s', '2013-10-01 00:00:00') > 0;

To delete, just replace SELECT * with DELETE and press F9 to execute the query.

(In case, the "Archive History" file holds the last history archived by Chrome).

When you're done, if needed, rename back the file to "History".

Automating it

You need a command-line SQLite utility such as sqlite3 or sql3tool. Then you write a script or batch file, modifying the code below with the appropriate paths (you don't want to clear my history leaving yours untouched, do you?):

# ENSURE CHROME IS CLOSED (pskill by SysInternals might be useful)
echo "DELETE * FROM urls WHERE url LIKE '%facebook%' OR url LIKE '%twitter%';" | sql3tool "C:\Documents and Settings\Leonardo Serni\Impostazioni locali\Dati applicazioni\Google\Chrome\User Data\Default\History"
echo "DELETE * FROM urls WHERE url LIKE '%porn%' OR url LIKE '%my-employer-is-a-moron%';" | sql3tool "C:\Documents and Settings\Leonardo Serni\Impostazioni locali\Dati applicazioni\Google\Chrome\User Data\Default\History"
echo "DELETE * FROM urls WHERE url LIKE ..."

Only remember that this erases your history on your instance of Chrome. If, for example, you use a proxy, and that proxy keeps logs, all those URLs will be still available in the logs.

UPDATE: Also, if you're using some brain-dead SQL tool that requires the file to have an explicit and known extension, you will have to perform an appropriate RENAME before starting operations, and another to put things back in order when you've finished.

Anyway, once this is done, doubleclick on the script icon and hey presto!, your Chrome history is sanitized. Should work with Firefox too: I saw SQLite3 files in there. Timestamps might be in some other time reference frame, though (possibly plain Unix), so check the water before jumping in.

And then there's cookies.

But you'll have noticed, in the Chrome data directory, other files, one of which is named Cookies... :-)

share|improve this answer

You can take the hacker shortcut injecting JavaScript code.

Step 1 Since Chrome history is queried inside a iFrame, we have to visit: chrome://history-frame/ (copy and paste URL)

Step 2 Do the search query.

Step 3 Open the Chrome console(F12 or CtrlShifti or i) and execute:

var inputs = document.getElementsByTagName('input');
for (var i = 0; i < inputs.length; ++i) {
  if (inputs[i].type == "checkbox"){
    inputs[i].checked = true;
  }
}
document.getElementById("remove-selected").disabled = false

Step 4 Hit the 'Remove selected items' button.

Actually this deletes the elements in the current page. I might try to extend it, but it's a good starting point.

share|improve this answer
    
check my answer again i've updated it –  Pooya Estakhri Aug 5 at 17:15

No, that is currently not supported by Chrome itself.

Though, extensions can request access to your history data. So it would be possible for an extension to fulfill your needs. I do not know of such an extension myself, but a small search, made me find this one:

https://chrome.google.com/webstore/detail/gjieilkfnnjoihjjonajndjldjoagffm

Possibly that extension can do what you request.

share|improve this answer
2  
This answer is outdated - see this one or this one –  Garrulinae Apr 30 at 6:32
    
I cannot delete it either, sorry –  Steven Roose May 6 at 7:23
    
That's fine - I'm just pointing it out for future viewers. –  Garrulinae May 6 at 8:33
    
The sad thing is that I lose rep for this :p –  Steven Roose May 7 at 11:59
    
No extension needed, check my answer :) –  Fabricio PH Aug 3 at 2:38

Just use Chrome with the url : chrome://history/#e=1&p=0

You may have to copy/paste it into your url bar.

share|improve this answer

In the Chrome bar try searching for the history item you want deleted. Once it appears in the results, scroll down to it using arrow keys (even if it is the first item in the list) and press Shift + Delete.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.