可能有很多原因,您可能希望禁止、阻止或将某些网站列入黑名单,使其无法在系统的浏览器中打开。您可能是一个不希望在您的组织的计算机上打开某些网站的组织,或者您可能是一个担心的父母,不希望他或她的孩子看到令人不安的内容。本文介绍了在 Windows 10 PC 上的浏览器中将网站列入黑名单或阻止网站(blacklist or block websites)的不同方法。
如何将网站列入黑名单或阻止网站
1]使用代理脚本(Using Proxy Script)在Chrome、Edge、IE中阻止网站
您可以使用代理脚本来阻止除属于您组织的网站之外的所有网站。实际上,您在这里将一个站点列入白名单,并阻止其他站点。我在berkeley.edu(berkeley.edu)找到了一个脚本,它执行以下操作:
function FindProxyForURL(url, host) {
// Bypass the proxy for *.thewindowsclub.com
if (dnsDomainIs(host, ".thewindowsclub.com")) {
return "DIRECT";
}
return "PROXY http://127.0.0.1:18080";
} // End of function
如果您将上述脚本复制到记事本(Notepad)并将其保存为.pac文件,您将能够打开仅与TheWindowsClub.com、主要博客站点、新闻和论坛相关的网站。如果您尝试打开任何其他网站,您将收到警告并且该网站将无法打开。您可以将站点名称更改为您组织的网站,以便您组织的用户只能访问您组织的网站。这将是您组织的主要网站和所有子域。
您必须使用控制面板(Control Panel)中的Internet 选项(Options)对其进行配置。在连接(Connections)选项卡中,单击LAN设置。取消选中“自动检测设置”。单击(Click)以选中名为“使用自动配置脚本”的框。
在地址字段中,键入.pac文件的位置,如下所示:
File://C:/Path/script.pac
File:// 保持不变,而路径和文件名可能会根据您保存文件的位置和文件名称而有所不同。请注意,我们在Internet URL(Internet URLs)的情况下使用正斜杠而不是反斜杠。
由于Chrome 和 Edge(Chrome and Edge)还使用Internet 选项(Options)中的代理设置,这将影响Internet Explorer、Chrome和Edge ( Chromium )。这篇文章展示了如何在 Microsoft Edge 中阻止网站(how to block a website in Microsoft Edge)。
但是,这种方法非常严格,可能无法满足许多人的目的。在Edge(Edge)、Firefox、Chrome、Internet Explorer和其他浏览器中还有其他方法可以阻止网站或将网站列入黑名单。让我们来看看它们。
阅读(Read):如何解除封锁和访问被封锁或受限制的网站(unblock and access Blocked or Restricted Websites)。
2]使用HOSTS文件阻止个别网站
Hosts File是一个临时DNS缓存,可以更快地打开网站。您可以使用此文件拒绝个别网站。Windows中的Hosts文件位于以下位置:
C:WindowsSystem32驱动程序等
您将不得不编辑主机文件(edit the Hosts File)。右键单击该文件并使用记事本(Notepad)打开该文件。对于您希望列入黑名单的每个网站,添加一个新行,并按以下格式创建一个条目:
127.0.0.1 website.com
保存文件并关闭它。您会发现您现在无法访问使用上述格式添加到HOSTS文件中的网站。(HOSTS)
确保您使用网站的变体,以便其他人无法使用这些变体。例如,如果您阻止 facebook.com,您还需要阻止 m.facebook.com,以便用户无法访问移动网站。(Make sure you use variations of the websites so that others cannot get in using the variations. For example, if you block facebook.com, you will also want to block m.facebook.com so that users cannot access the mobile site.)
3]在Internet Explorer中(Internet Explorer)使用内容顾问(Using Content Advisor)
您可以使用 Content Advisor阻止个别网站或按类别或(Category)性质阻止(Nature)网站。
4]在Internet选项中使用受限区域(Using Restricted Zone)
您还可以通过将选定网站添加到Internet 选项中的受限区域来阻止它们打开。
5] 使用OpenDNS将网站列入黑名单
OpenDNS提供的家长控制优于大多数其他免费DNS服务提供商。您只需选择要过滤的网站类型,OpenDNS就会为您完成工作。它也可能会阻止一些合法网站,但值得使用。Open DNS既免费又收费,在提供安全的DNS解析的同时,它还提供控制,例如孩子们何时可以使用计算机的时间。
6]使用Windows家长控制
通过某些DNS服务使用家长控制比本地服务要好得多。这就是为什么我在上面谈到了Open DNS的家长控制。您也可以使用家庭安全选项来执行相同操作。您必须登录您孩子的个人资料并为个人资料设置评级系统,以便孩子只能访问似乎符合该个人资料的网站。您将不得不对其他孩子的其他个人资料重复相同的操作。这种方法不是百分百可靠,但您仍然可以根据内容评级将某些网站列入黑名单。您也可以使用一些免费的家长控制软件。(Free Parental Control Software.)
7]使用PowerShell
您还可以使用 PowerShell 阻止 IP 或网站(block an IP or a Website using PowerShell)。
8]使用附加组件和扩展
如果您使用的是Chrome和Firefox,您可以获得将网站列入黑名单的扩展程序。您还可以在扩展程序中设置密码,以便其他人不会更改设置。一些这样的扩展是用于 Chrome 的BlockSite和 Whitelist。您也可以在新 Edge 上使用这些 Chrome 扩展程序(use these Chrome extensions on the new Edge)。Firefox用户可以查看BlockSite或 Minimal Site Block。
不幸的是,Internet Explorer没有此类附加组件,但您可以在Internet选项中使用(Options)受限站点和内容顾问。然而,这两个并不像在所有浏览器上使用专门的插件来将网站列入黑名单或阻止网站那样有效。
URL Blocker是另一个很好的免费工具,可以帮助您阻止网站。
如果您对此主题有更多想法,请在下面分享,我会更新帖子。(If you have any more ideas on the subject, please do share below, and I will update the post.)
如果出于安全原因将Windows 10 中的程序列入白名单,这篇文章将为您提供帮助。
How to blacklist or block websites in Chrome, Firefox, Edge browsers
There may be many reasons, you might want to ban, block, or blackliѕt certain websites from being opened in a browser on your system. You might be an organizatiоn that does not want some websites to be opened in your organization’ѕ computers, or you may be a concerned parent who dоeѕ not want his or her kids to see disturbing content. The artіcle еxplains different methods to blacklist or block websites in browsers on a Windows 10 PC.
How to blacklist or block websites
1] Using Proxy Script to block websites in Chrome, Edge, IE
You can use a proxy script to block all websites except the ones belonging to your organization. In effect, you are whitelisting one site here, and blocking out the others. I found a script at berkeley.edu, which does this:
function FindProxyForURL(url, host) {
// Bypass the proxy for *.thewindowsclub.com
if (dnsDomainIs(host, ".thewindowsclub.com")) {
return "DIRECT";
}
return "PROXY http://127.0.0.1:18080";
} // End of function
If you copy the above script to Notepad and save it as a .pac file, you will be able to open websites related only to TheWindowsClub.com, main blog site, news, and forum. If you try to open any other website, you will receive a warning and the site will not open. You can change the site name to your organization’s website so that users of your organization can access only the websites of your organization. That will be the main website and all the subdomains of your organization.
You have to configure it using Internet Options in Control Panel. In the Connections tab, click on LAN settings. Uncheck “Automatically Detect Settings”. Click to check the box named “Use automatic configuration script”.
In the address field, type the location of .pac file as following:
File://C:/Path/script.pac
File:// remains the same while path and filename may vary based upon where you saved the file and what you named the file. Note that we used forward slashes instead of backslashes as in the case of Internet URLs.
Since Chrome and Edge also use proxy settings from Internet Options, this will affect both Internet Explorer, Chrome, and Edge (Chromium). This post shows how to block a website in Microsoft Edge.
However, this method is pretty restrictive and may not serve the purpose of many. There are other ways to block or blacklist websites in Edge, Firefox, Chrome, Internet Explorer and other browsers. Let us have a look at them.
Read: How to unblock and access Blocked or Restricted Websites.
2] Using HOSTS file to block individual websites
Hosts File is a temporary DNS cache that allows for a speedier opening of websites. You can use this file to reject individual websites. The Hosts file in Windows is located at the following location:
C:\Windows\System32\drivers\etc
You will have to edit the Hosts File. Right-click on the file and use Notepad to open the file. For each website you wish to blacklist, add a new line, and create an entry in the following format:
127.0.0.1 website.com
Save the file and close it. You will find that you are now not able to access the websites that you added to the HOSTS file using the above format.
Make sure you use variations of the websites so that others cannot get in using the variations. For example, if you block facebook.com, you will also want to block m.facebook.com so that users cannot access the mobile site.
3] Using Content Advisor in Internet Explorer
You can block individual websites or block websites by Category or Nature, using Content Advisor.
4] Using Restricted Zone in Internet Options
You can also block select website from opening by adding them to Restricted Zone in Internet Option.
5] Using OpenDNS to Blacklist Websites
The parental controls offered by OpenDNS are better than most other free DNS service providers. You just select the type of websites to be filtered and then, OpenDNS does the work for you. It might block some legitimate websites too, but it is worth using. Open DNS is both free and paid and while providing safe DNS resolutions, it also offers controls such as timings as to when the kids can use the computers.
6] Using Windows Parental Controls
The usage of parental controls via some DNS service is much better than a local one. That is why I talked about the parental controls of Open DNS above. You can also do the same using the Family Safety option. You will have to log into your kid’s profile and set up a rating system for the profile so that the child can access only the websites that seem eligible for that profile. You will have to repeat the same for other profiles of other kids. This method is not a hundred percent reliable, but you still get to blacklist some of the websites based on the content rating. You may also use some Free Parental Control Software.
7] Using PowerShell
You can also block an IP or a Website using PowerShell.
8] Using Add-ons and Extensions
If you are using Chrome and Firefox, you can get extensions that blacklist websites for you. You can also set up passwords in the extensions so that others do not change the settings. Some such extensions are BlockSite and Whitelist for Chrome. You can use these Chrome extensions on the new Edge as well. Firefox users can check out BlockSite or Minimal Site Block.
Unfortunately, Internet Explorer does not have such add-ons but you might use Restricted Sites and Content Advisor in the Internet Options. These two, however, are not as effective as having a dedicated add-on for blacklisting or blocking websites on all browsers.
URL Blocker is another good free tool to help you block sites.
If you have any more ideas on the subject, please do share below, and I will update the post.
This post will help you if whitelist programs in Windows 10, for security reasons.