From a C# application I want to activate (brint to front) a site that is already open in the users default browser. I want to do this in a browser agnostic way.
The
This will work, IF the user has that site active in their browser. If they're using a tabbed browser, and the site is open, but not in the selected tab, I don't believe you will ever find the browser window. (EnumWindows only enumerates top-level windows).
If the user's started a new tab, you'll end up not finding it, and (likely) starting a second copy of the site in a new tab.
Personally, if you really need to restrict to a single browser instance, I would consider whether its possible to embed the browser in your application instead of using the default browser. If this can be made a GUI element in your application using a browser control, you'd have much more control and be able to avoid this type of workaround.