Reverse engineering some settings for Google Search
As part of switching to uMatrix, I wound up destabilizing my Google cookies and thus more or less destroyed my old Google search settings (as I mentioned in passing in the original entry). This isn't the first time something like this has happened, but this time around I've managed to work out roughly what all of the magic processes are to manipulate them back to the way they used to be.
Google Search has at least three separate settings:
- The straightforward search preferences for things like how many results
are displayed on a single page. Google directly supports changing
these through their search settings.
(There are two versions of this settings page; see the end.)
- Whether or not visiting google.com redirects you to your country
Google domain (I believe the term for this is a 'country redirect').
You can turn off country redirects by visiting the magic URL
www.google.com/ncr, which sets some
opaque magic cookie value. I don't know how you turn country redirects
back on, or if there's any way short of deleting your Google cookies.
(As you can tell, I always turn country redirects off and leave them off. When I go to google.com, that's where I want to be; if I wanted google.ca, I would go there explicitly. I believe that Google still gives me somewhat location-based results, but at least I usually get to see the Google doodles.)
JS results page [JPG].
One difference between these two pages that isn't obvious in my
screenshots is how the URLs are handled. In the non-JS version,
Google rewrites all of the actual links to be redirected through
themselves for click-tracking. In the JS version, the links are
intact and this tracking is done through an
(The JS version will do various things not pictured here, such as put in images and other content. The non-JS version sticks to plain, straightforward search results.)
To complicate the picture, some Firefox addons (at least NoScript) will apparently fix Google's link mangling in the non-JS version, although this fixing isn't necessarily instant or complete.
How the two versions of the results page switch back and forth is complicated. As far as I can tell, it goes like this:
you get the non-JS version, with all of the URL links rewritten
to go through Google with tracking information. Google also
sets a magic cookie so that this state is persistent as long
as you have JS off (even if you later stop interpreting <noscript>
(If you have the magic cookie, your search result is immediately the non-JS page. If you don't, you first wind up on the JS page but a <noscript> tag redirects you to the non-JS version.)
version (and Google tracks your clicks on the URLs through JS).
Doing a search with JS on clears the magic cookie from above.
- If you have JS off, don't interpret <noscript> tags, and don't have the magic cookie, you get the JS version (with a <noscript> tag that would redirect you to the non-JS version if you were to interpret it). Since it's the JS version, it has the URLs not mangled (and your history works so you know if you've already read a search result), but since you're not interpreting JS, Google doesn't get to track your clicks.
Until I did the experimentation for this entry, I didn't know how to switch my current uMatrix setup over to the non-JS version. Now that I do, I'm still going to stay with the JS version for the better URLs for now, although I may get irritated with its various annoyances and change my mind.
(There's probably a GreaseMonkey user script to fix the URLs, but
I've had memory leak problems with GreaseMonkey in the past so I'm
not entirely enthused about the idea of re-enabling it. In theory
I could probably also write a Firefox WebExtension addon to do this,
since it's just modifying the
href attribute of
that match a specific pattern.)