使用C#关闭许多其他打开的选项卡中的特定浏览器选项卡 [英] close a specific browser tab among many other open tabs using C#

查看:185
本文介绍了使用C#关闭许多其他打开的选项卡中的特定浏览器选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个基于C#.Net windows的应用程序。我想使用C#打开和关闭网址(浏览器标签)。



目前我正在使用以下代码

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

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.
            }



但它会关闭Chrome浏览器而非特定标签。如何在所有选项卡中关闭特定选项卡。我必须为所有浏览器实现这一点。如何实现这一目标?


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?

推荐答案

AFAIK,您无法在任何浏览器中关闭特定选项卡。

这是可能的您可以为每个浏览器编写一个扩展程序,允许您这样做,但是必须安装扩展程序。



如果你想这样做例如,你的用户无法访问FarceBook或Twatter,你最好设置一个首先禁止访问的代理 - 它会更容易,也更安全。
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.

这篇关于使用C#关闭许多其他打开的选项卡中的特定浏览器选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆