Advertising is the revenue source of the Website, but sometimes the popup ads (shows another window) or the ads with sock content still annoy you. Normally, if you want to block ads, you will install Adblock or Adguard, but that will accidentally block useful and suitable ads for you. If you still want to support Websites with good content with clean ads and do not want to display ads with unsightly pop-ups, you can block POPUP ads with the hosts file.
Join the channel Telegram of the AnonyViet 👉 Link 👈 |
You can also way ad blocking on Spotify similar to the hosts file.
What are File Hosts?
The hosts file is a plain text file containing a list of names hosting server and IP address corresponding. This is essentially a database of domain names used by the operating system to determine the IP address of a server in a network environment.
The structure of the hosts file will be:
IPÂ Â Â Server
Eg:
8.8.8.8 google.com
So your computer will understand that google.com has an IP of 8.8.8.8. When you use a browser to access Google, the browser will query to IP 8.8.8.8 to display the website to you.
So to use the hosts file to block POPUP ads, you will redirect the addresses of the ad links pointing to the IP. 127.0.0.1
(This is the loopback address on your computer). So the ad will not show up half.
How to block ads with hosts file
First you need to go to the path:
- Windows:
C:\Windows\System32\drivers\etc
- Linux:
/etc/hosts
Then open the hosts file to edit the content inside.
By default from Windows 7 onwards, for security reasons you cannot edit directly on the hosts file. So you should use the software notepad++ to open and edit files.
Next copy the entire content in the link https://someonewhocares.org/hosts/ Go to the hosts file and save it. This is a list of websites with unhealthy content and offensive advertisements. The above link will regularly update the advertising addresses, you come back from time to time to update new addresses.
Besides, you can use the software Hosts Editor interface for ease of use.
Reference: Bui Nguyen Hoang Tho