I was looking into google.com's Net activity in firebug just because I was curious and noticed a request was returning "204 No Content."
It turns out that a 204 No Content "is primarily intended to allow input for actions to take place without causing a change to the user agent's active document view, although any new or updated metainformation SHOULD be applied to the document currently in the user agent's active view." Whatever.
I've looked into the JS source code and saw that "generate_204" is requested like this:
(new Image).src="http://clients1.google.com/generate_204"
No variable declaration/assignment at all.
My first idea is that it was being used to track if Javascript is enabled. But the "(new Image).src='...'" call is called from a dynamically loaded external JS file anyway, so that would be pointless.
Anyone have any ideas as to what the point could be?
UPDATE
"/generate_204" appears to be available on many google services/servers (e.g., maps.google.com/generate_204, maps.gstatic.com/generate_204, etc...).
You can take advantage of this by pre-fetching the generate_204 pages for each google-owned service your web app may use. Like This:
window.onload = function(){
var two_o_fours = [
// google maps domain ...
"http://maps.google.com/generate_204",
// google maps images domains ...
"http://mt0.google.com/generate_204",
"http://mt1.google.com/generate_204",
"http://mt2.google.com/generate_204",
"http://mt3.google.com/generate_204",
// you can add your own 204 page for your subdomains too!
"http://sub.domain.com/generate_204"
];
for(var i = 0, l = two_o_fours.length; i < l; ++i){
(new Image).src = two_o_fours[i];
}
};
Well i have been looking at this for a few times and resulted that Google logs referer's where they come from first time visiting the google.com for ex; tracking with Google Chrome i have a 90% guess that its for Logging Referers, maybe User-Agent statistics well known when Google release its list of standards of browser usage:
Request URL: http://clients1.google.se/generate_204
Request Method: GET
Status Code: 204 No Content
Response Headers
Here "Referer" under "^Request Headers" shows Googles statistics that many folks come from Microsoft.com, also parsing out the word "Windows 7" to help me focus on Windows 7 in my up-following searches that session
//Steven
Font: Google Chrome Privacy Whitepaper
I found this old Thread while google'ing for generate_204 as Android seems to use this to determine if the wlan is open (response 204 is received) closed (no response at all) or blocked (redirect to captive portal is present). In that case a notification is shown that a log-in to WiFi is required...
with the massive remit by google to stop both spam and the scraping of their search database, I believe that this is part of the effort to track bots etc.
some simple anti bot pseudo could go like this.
I also believe that the latest google frontpage 'theme' is also a new tool to help with the anti spam/bot activity.
** NOTE ** ipv6.google.com also includes this measure.
Just my unfounded unproofed two 2p.
The generate 204 might be dynamically loading the suggestions of search criteria. AS i can see from my load test script, this is seemingly responsible for every server call each time the user types into the text box
This documents explains:
http://docs.lib.purdue.edu/cgi/viewcontent.cgi?article=1417&context=ecetr&sei-redir=1
(Search for generate204)
Relevant section: