有选择地删除Chrome浏览历史记录

时间:2013-09-03 17:12:11

标签: google-chrome browser-history

是否可以有选择地从Google Chrome浏览历史记录中删除项目?我的历史记录中有一个网站希望每次我开始使用特定字母进行搜索时都是默认网站,但我经常会参考我的历史来重新查找内容。

所以我想从www.pythonismyfavoritest.com删除所有历史记录而不删除所有内容;那可能吗?

5 个答案:

答案 0 :(得分:19)

尝试在www.pythonismyfavoritest.com的搜索栏中搜索chrome://history/,然后点击左侧的复选框,然后按“删除所选项目”按钮,删除每个项目。

Chrome历史记录api与网址chrome://history/#q=hello&p=0

一起使用

https://dl.dropboxusercontent.com/u/31568408/Capture.PNG

答案 1 :(得分:19)

这是我用JavaScript编写的内容。它通过Console Debugger工作。我尝试在书签中使用它,但我没有得到页面的回复。

** //更新(07.28.15)
我添加了@Denis Gorbachev提供的更短的方法来进行复选框定位,这有助于缩短部分代码。我还添加了“自动停止”功能,这意味着一旦它最终清除了列表,循环就会停止。

** //更新(08.20.14)
我对代码进行了一些更改,以使其更加用户友好。其他用户可能不熟悉代码,而其他用户可能只是喜欢方便。因此,我掀起了几个按钮(开始/停止)来控制使用;以及解决在尝试运行脚本循环时抛出的一些“ASSERTION FAILED”异常/错误。享受!!

在您的地址栏中,输入以下地址到历史记录页面的内容。它通常在iframe中加载,左侧菜单在另一个框架中加载.. / / **

chrome://history-frame/

接下来,按 Ctrl + Shift + J 加载您的控制台调试器/查看器(对于Mac用户, + + Ĵ

您也可以按 F12 并选择“控制台”标签。

控制台调试器/查看器中,复制&粘贴以下代码:

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);

此removeItems函数将选择循环遍历所有表单输入并选中所有复选框,启用“删除所选项目”按钮并单击它。半秒后,它将检查是否显示“Are You Sure”提示,如果是,则自动为您单击“是/删除”按钮,以便它将加载新的项目列表以执行此过程一遍又一遍......

该项目使用变量“clearAllFiltered”进行循环,该变量是一个setInterval循环,用于检查“正在加载”屏幕的状态。

要开始删除已过滤的历史记录项,您现在可以点击绿色 开始 按钮。

** //更新(07.28.2015)它现在将自动停止。

要手动停止循环,您现在可以点击红色 停止 按钮。就这么简单!

答案 2 :(得分:9)

1)转到历史记录设置(chrome:// history /)

2)右上角将是一个带有“搜索记录”按钮的搜索栏

3)键入要从历史记录中删除的网站名称,然后单击按钮

4)单击第一个框,然后滚动到页面底部

5)按住Shift键,然后单击最后一个框(这将检查该页面上的所有内容)

6)向上滚动并选择“删除所选项目”按钮

7)重复步骤4-6,直到所有Youtube历史记录消失。

希望Chrome会更新这个清晰的历史记录功能,但目前这似乎是最快的选择

答案 3 :(得分:5)

简单的方法是Shift + Delete。

例如,当您键入"您"," youtube.com"将在建议中显示为已选中。只需点击Shift + Delete即可。然后重新输入"你"你会看到没有" youtube.com"在那个名单中。

答案 4 :(得分:1)

如果您正在谈论摆脱建议的搜索/自动完成...然后从您的chrome://历史记录中删除特定项目将不会这样做(根据我的经验)。我想在@LacOniC给出的答案中填写更多详细信息。

Chrome Auto-complete

在屏幕截图中,您可以看到我输入“ba”,Chrome根据我的浏览历史记录建议完成(绿色项目)。

根据我的经验,从历史记录中删除特定项目不会将其从此地址栏自动完成中删除。

要快速删除这些自动完成的项目:

  1. 开始输入几个产生违规建议的字母。
  2. 使用键盘的箭头键选择您不喜欢的建议(截图中所选项目以蓝色突出显示)。
  3. 按Windows上的shift+delete或Mac上的shift+fn+delete删除所选项目。