如何删除谷歌浏览器中特定网站的所有历史记录

问题描述 投票:0回答:3

在谷歌浏览器的history部分,我想删除与特定网站相关的所有历史记录,例如:

facebook.com
,我可以搜索
facebook.com
,然后选择所有复选框并删除,但这是一项耗时的工作。

有什么简单的方法可以清除特定网站的历史记录吗? 甚至通过编写代码或脚本?

google-chrome browser-history
3个回答
4
投票

打开历史记录管理器,搜索 facebook.com...不要单独单击所有复选框。单击第一个框,滚动到页面底部并按住 Shift 键,同时单击最后一个框,它将一次选择所有框。

专业提示:如果您想访问网站而不留下历史记录条目,请进入隐身模式(control-shift-p)。

或者,Control-A 键盘快捷键也将选择所有复选框! https://techdows.com/2018/02/chrome-history-page-ctrl-a-now-selects-all-history-items.html#:~:text=Chrome%20history%20Page%3A%20Ctrl% 2BA%20now%20selects%20all%20items&text=现在%20the%20addition%20of%20Ctrl,或%20unselect%20multiple%20history%20items.&text=The%20thing%20is%2C%20only%20150,page%20has%20more% 20条历史%20条.


0
投票

您可以在控制台中使用一些脚本来单击包含子字符串的

href
条目的复选框。

这个答案使用这个其他SO答案在

querySelectorAll
上,适用于开放影子DOM中的东西

function $$$(selector, rootNode=document.body) {
    const arr = []
    
    const traverser = node => {
        // 1. decline all nodes that are not elements
        if(node.nodeType !== Node.ELEMENT_NODE) {
            return
        }
        
        // 2. add the node to the array, if it matches the selector
        if(node.matches(selector)) {
            arr.push(node)
        }
        
        // 3. loop through the children
        const children = node.children
        if (children.length) {
            for(const child of children) {
                traverser(child)
            }
        }
        
        // 4. check for shadow DOM, and loop through it's children
        const shadowRoot = node.shadowRoot
        if (shadowRoot) {
            const shadowChildren = shadowRoot.children
            for(const shadowChild of shadowChildren) {
                traverser(shadowChild)
            }
        }
    }
    
    traverser(rootNode)
    
    return arr
}
arr = $$$('[href*="example.com"]');
// this code will need to be updated if the source code for the chrome history browser changes.
arr.map(e => e.closest("#item-info")
  .previousElementSibling
  .previousElementSibling
).forEach(e=>e.click());

这将点击当前页面上所有匹配的条目,然后您只需点击按钮即可删除选中的条目。


0
投票

这是一个非常简单的方法。只需要按照以下步骤操作:

  1. 打开历史记录部分,无论使用快捷键 ctrl+h 还是使用 镀铬右侧部分的三个点。
  2. 然后,搜索您要删除历史记录的网站,例如 www.facebook.com'.
  3. 接下来,使用 ctrl+a 快捷键。必须选中所有复选框。
  4. 最后,顶部有一个删除按钮。按下它。
  5. 你已经完成了。

====================================================== =========================

© www.soinside.com 2019 - 2024. All rights reserved.