I went to the Samsung.co.uk website today and was greeted with a blank page and “waiting for platform.twitter.com” in the status bar for some time. This happens on many pages where the page is waiting for content from another site, which is slow to respond. Twitter in particular has a history of many load issues (see the Wikipedia Entry, Outages section).
In order to avoid these on your computer you can effectively tell it to ignore requests for certain URLs in Windows by adding them to your hosts file. On a Mac or Linux it is also possible using a different method (e.g. using Iptables) although that is outside the scope of this post.
Suitable hosts files can be found here.
- edit /etc/hosts as admin e.g.
sudo vi /etc/hosts
- Paste in the bad hosts
- Open Notepad as an administrator (Start, type Notepad, once selected press Ctrl Shift and Enter simultaneously)
- Select File, Open (Alt F, O) and browse to:
- on a Windows 7 machine, other versions might use a slightly different path.
- Change file type to “All Files”:
- Open hosts
- Add the bad hosts at the bottom e.g.:127.0.0.1 platform.twitter.com
- Save and exit.
How it works
Operating systems consult the hosts file when resolving domain names, and entries there override those obtained from the DNS server. This entry basically says for the URL “platform.twitter.com” go to 127.0.0.1 which is the local machine i.e. nothing.
Create a Shortcut To Edit Hosts
If you want to alter the file regularly the operation above can become a bit tiresome so I like to create a short-cut:
- Show the Desktop by pressing Windows key and D
- Click Start, start typing Notepad and when it appears in the list right click on it and drag it to the desktop. This will bring up a menu. Select Create Shortcut.
- Right click on the new shortcut and choose Properties
- In the Shortcut tab append a space and the path to the hosts file in the target field, so mine ends up looking like:
- %windir%\system32\notepad.exe C:\Windows\System32\drivers\etc\hosts
NB: It might throw a “name specified not…" error here: see earlier post.
- Click Advanced and select "Run as Administrator".
- Click OK twice and try out your new short-cut. It should bring up the hosts file ready for editing (and possibly an administration confirmation).
Thank you so much for this insight. It has been a pain for the last several days. Now I am back up and accessing all of my regular sites.