HI friends,
Please help me that
there is any way to check whether any web browser is open or not in the system.
HI friends,
Please help me that
there is any way to check whether any web browser is open or not in the system.
asked whether you can detect if a browser is open, and correctly clarified whether you meant "any" browser or specific ones. A practical, widely compatible approach is to scan running processes and match them against a short, maintainable list of known browser executable names (chrome, firefox, msedge, iexplore, opera, etc.). This is simple and works in most real-world cases.
Example in C# (Windows/.NET): look at process names rather than MainModule (safer for permissions).
using System;
using System.Diagnostics;
using System.Linq;
string[] browsers = { "chrome", "msedge", "firefox", "iexplore", "opera", "brave", "vivaldi", "safari" };
bool AnyBrowserOpen()
{
return Process.GetProcesses().Any(p =>
{
try { return browsers.Contains(p.ProcessName, StringComparer.OrdinalIgnoreCase); }
catch { return false; }
});
} Example in Python (cross-platform, requires psutil):
import os
import psutil
BROWSERS = {'chrome','msedge','firefox','iexplore','opera','brave','vivaldi','safari'}
def any_browser_open():
for p in psutil.process_iter(['name']):
try:
name = p.info['name']
if not name:
continue
base = os.path.splitext(name)[0].lower()
if base in BROWSERS:
return True
except (psutil.NoSuchProcess, psutil.AccessDenied):
pass
return False Notes and cautions: process-name matching is brittle—portable or renamed browsers will be missed. Access to some process details can be blocked by permissions; avoid reading MainModule unless you handle exceptions. For higher accuracy, build the browser list from the system registry (Windows StartMenuInternet keys) or enumerate top-level windows and check known window classes, but those methods are more platform-specific. Update the name list as new browsers appear.
Jump to Post— Salem 6,009You mean "ANY" browser, or just the usual suspects like Firefox, Opera or IE?
You mean "ANY" browser, or just the usual suspects like Firefox, Opera or IE?
yes, exactly the same
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.