Search code examples
c#winformsbrowserfavorites

Accessing Browser Favorites (WinForms/C#)


Where and how can I access web browser Favorites and history?

Is it the same place for all browsers?

Thanks!


Solution

  • this is a small code to get the history for IE :

        public List<string> PopulateUrlList()
    {
        string regKey = "Software\\Microsoft\\Internet Explorer\\TypedURLs";
        RegistryKey subKey = Registry.CurrentUser.OpenSubKey(regKey);
        string url = null;
        List<string> urlList = new List<string>();
        int counter = 1;
        while (true) {
            string sValName = "url" + counter.ToString();
            url = (string)subKey.GetValue(sValName);
            if ((object)url == null) {
                break; // TODO: might not be correct. Was : Exit While
            }
            urlList.Add(url);
            counter += 1;
        }
        return urlList;
    }