chrome访问浏览器的历史记录 [英] chrome access browser history

查看:112
本文介绍了chrome访问浏览器的历史记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过带有弹出页面的浏览器操作来访问chrome浏览器的历史记录.

I'm trying to access my browser history in chrome, using a browser action with a popup page.

var histories = [];
var visits = [];

chrome.history.search({'text':'', 'maxResults':0}, function(historyItems){
    for(var h in historyItems){
        histories.push({'id': h.id, 'url':h.url});
    }
});

for(var h in histories){
    chrome.history.getVisits({'url': h.url, function(visitItems){
        for(var v in visitItems){
            var id = v.id;
            var visitId = v.visitId;
            var visitTime = v.visitTime;
            var referringVisitId = v.referringVisitId;
            var transition = v.transition;
            visits.push({'id': v.id, 'visitId': v.visitId, 'visitTime': v.visitTime, 'referringVisitId': v.referringVisitId, 'transition':v.transition});
        }
    });
}

console.log(histories.length + ' histories');
console.log(visits.length + ' visits');

结果,我得到234个历史记录和0次访问.我怎么会有一堆没有访问的页面? 我在做什么错了?

I get 234 histories and 0 visits as a result. How can I have a bunch of pages with no visits? What am I doing wrong?

推荐答案

问题是,这在webkit(chrome,safari e.a)内部不再起作用.它的缺失(遍历访问)修复了一个安全漏洞,该漏洞使访问过的链接公开到任何网站.通过一些随机的猜测,可以跟踪和描述访问者,这被认为是违反隐私的行为.

The problem is, this does not work anymore inside webkit (chrome, safari e.a). It's absence (traversing the visits) fixes a security-bug which exposes the visited links to any website. With some random guessing it was possible to track and profile visitors, which was considered a privacy-breach.

这篇关于chrome访问浏览器的历史记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆