accessing history in a firefox addon

。_饼干妹妹 提交于 2019-12-21 02:41:49

问题


I'm working on a firefox addon, using the addon builder. I want to periodically scan the browser's history.. the entire history. I'm looking for functionality like chrome's history api. It seems window.history is limited to session history only. Any help? I'm going crazy trying to figure this out. Addons like history export must do something like this, but their code is not immediately understandable to me.


回答1:


You'll need to access the xpcom service nsIBrowserHistory, here's some example code that works with the SDK:

https://builder.addons.mozilla.org/package/157396/latest/

The places api is a bit verbose, there are extensive examples available on MDN:

https://developer.mozilla.org/en-US/docs/Querying_Places

There is also a module developed by Mozilla community members available here that provides some abstractions:

https://github.com/autonome/Jetpack-Modules/blob/master/places.js

I'm not sure if theabove module has been tested against recent versions of Firefox and the SDK.



来源:https://stackoverflow.com/questions/12901076/accessing-history-in-a-firefox-addon

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!