Я пишу приложение в системном трее, которое должно проверить, открыто ли открытое веб-приложение.
Я могу проверить IE, используя следующее:
SHDocVw.ShellWindows shellWindows = new SHDocVw.ShellWindows();
string filename;
bool sdOpen = false;
foreach (SHDocVw.InternetExplorer ie in shellWindows)
{
filename = Path.GetFileNameWithoutExtension(ie.FullName).ToLower();
if (filename.Equals("iexplore"))
{
string[] urlParts = (ie.LocationURL.ToString()).Split('/');
string website = urlParts[2];
if (website == "myApp:8080") { sdOpen = true; };
}
}
if (sdOpen) { Console.WriteLine("App is open"); } else { Console.WriteLine("App is not open"); };
Console.ReadKey(true);
Однако некоторые пользователи, использующие эту систему, предпочитают Chrome или Firefox.
Как я могу сделать то же самое, что и выше (т.е. получить URL-адреса любых открытых вкладок в браузере) для Chrome и Firefox? (Я не буду беспокоиться о других браузерах, поскольку они единственные, кто используется в нашей организации.)