Thursday, 11 October 2007

In Passing

How to kill that Snap popup - dead!


If you surf many blogs at all, you've probably run into the Snapshotsâ„¢ preview popup:
screenshot - snap popup
This "feature," which turned up at the beginning of the year, has the annoying habit of jumping up in front of the page you're reading should your mouse cursor innocently stray across any Snap-enabled link. If you're on a dialup the problem is worse: The popup locks up while its content loads. Some blogs apply Snap sensibly, by enabling Snap selectively and by putting a little icon that controls the popup adjacent to the enabled links.  Unfortunately, most of them, including all blogs hosted at WordPress, enable it by default

The "recommended" ways of blocking Snap are to (1) disable javascript or (2) give Snap a cookie. Each method has its disadvantages. But there's a third way to nuke the Snap function once and for all, one that doesn't require losing functionality or giving up privacy. 

If you add an entry to your hosts file, it will block all access to the site that delivers the Snap javascript. Since the code never gets loaded, the popups don't appear.  In the case of the Snap code, it all comes from the server spa.snap.com.

So the magic entry is:
127.0.0.1   spa.snap.com

Note: Once you've done this, you won't be able to access the address spa.snap.com even if you type it in your browser's address box... it's just like the site doesn't exist.

Detailed instructions, and an explanation of how it works, after the jump.

Elsewhere:


How it works (simplified):
The Hosts file contains the mappings of IP addresses to host names. This file is loaded into memory (cache) at startup, then Windows checks the Hosts file before it queries any DNS servers, which enables it to override addresses in the DNS. This prevents access to the listed sites by redirecting any connection attempts back to the local machine [which, since the site isn't on the local machine, returns nothing - o.g.]. -- mvps.org: "Blocking Unwanted Parasites With a HOSTS File
When your browser looks for a site (say microsoft.com) it sends the text name to your ISP's DNS server. The DNS server acts like a phonebook: It looks up "microsoft.com," finds its numeric address (207.46.232.182), and sends the numeric address back to your computer. Your computer then uses the numeric address to contact the (Microsoft) server and request the page you were looking for.

The Hosts file short-circuits the process. Before it queries the DNS server, your computer looks in the Hosts file to see if the site name is there. If it is, it uses the numeric address listed in the file, and skips the DNS step. This means if you put an invalid address in the host file, the browser will never find the site!

Now you don't want to use just any old group of numbers for your "invalid" address.[1] But there's a special address you can use: The "localhost" or "loopback" address "127.0.0.1". This address points your computer back at itself. Since the file you're looking for won't be on your own machine, you get nothing.

(It should be obvious that judicious application of Hosts entries can block all kinds of annoying stuff. Want to strip all the ads off your pages? Want to lock out porn.com? You can do that. However, that's beyond the scope of this post. Read the mvps.org article linked above for an idea of the possibilities.)

Create a Hosts entry to block Snap:
These instructions are Windows-centric. (Linux gurus will have already stopped reading.) Apple folks should use Google.
  1. First find out if you already have a Hosts file. Search the Windows directory and its subdirectories for "hosts.*": If it finds a file named "hosts" (no extension), you want to add an entry to that file. If the only file you find is "hosts.sam," you need to create one, and then add the entry.
  2. No "hosts" found: Use notepad to open hosts.sam. Immediately "save as" "hosts" (no extension) in the same folder.
  3. "hosts" found or created. Use notepad to open it (if it's not already open). Add this line to the end of the file:
    127.0.0.1     spa.snap.com
    (There should be at least one space between the first and second "words.") Save the file, and close it. 
  4. Depending on the version of Windows, you may have to reboot for this to take effect.
Congratulations, you're now routing all requests to spa.snap.com into a black hole.  Again, remember that your computer will never be able to find or load any files from "spa.snap.com," or at least, never until you remove that Hosts entry. Works for me!

------
[1] Think of putting random numbers in your speed dial-- or transferring all the outgoing calls to 911. Phreaking your neighbor by changing his Hosts file is beyond the scope of this post!

Posted by: Old Grouch in In Passing at 01:19:14 GMT | No Comments | Add Comment
Post contains 825 words, total size 7 kb.

Comments are disabled. Post is locked.
73kb generated in CPU 0.0101, elapsed 0.179 seconds.
51 queries taking 0.1729 seconds, 207 records returned.
Powered by Minx 1.1.6c-pink.