google-chromegoogle-chrome-extension

Google Chrome Extension, Getting The User's Most Viewed Websites


In my New Tab page I would really like to add an area where the user can easily go to their most visited websites, how would I go about finding what the users most visited websites are without asking them?

Also how would I get recently closed tabs?


Solution

  • You can use the topSites api to retrieve the list of sites that would by default be on the new tab page.

    If you want more info than provided by this API, you could also have a look at the history API and bookmarks API to find out what websites the user visits often.

    I do not know of any way to find recently close tabs, but you can listed to the tabs.onRemove event and store infos about the tab at the time they get closed.