Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am working on a C# .Net windows based application. I want to open and close a url(browser tab) using C#.

currently I am using following code
C#
System.Diagnostics.Process[] procs = System.Diagnostics.Process.GetProcessesByName("CHROME");

            foreach (System.Diagnostics.Process proc in procs)
            {
                // Look for Google title.

                if (proc.MainWindowTitle.ToLower().IndexOf("telerik") > -1)
                    proc.Kill(); // Close it down.
            }

but it closes Chrome browser and not a particular tab. How can I close a specific tab among all tabs. I have to implement this for all browsers too. How can I achieve this?
Posted
Updated 13-Aug-15 21:36pm
v4

1 solution

AFAIK, there is no way that you can close a specific tab in any browser.
It's possible that you could write an extension for each browser which allows you to do that, but then the extension would have to be installed.

If you are trying to do this so that your users can't access FarceBook, or Twatter for example, you would be better off setting up a proxy which forbids access in the first place instead - it would be a lot easier, and more secure.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900