ColdFusion CGI variables and Spiders

What's wrong with this bit of code?

view plain print about
1<cfset languages = CGI.HTTP_ACCEPT_LANGUAGE>

Well nothing as long as the page is viewed with a browser. However a cgi variable in your code may not exist if a spider rather than a browser looks at your site. This includes spiders like google. Your site may not be indexed by search engines if you don't handle CGI variables correctly.


Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
From the docs

Testing for CGI variables

Because some browsers do not support some CGI variables, ColdFusion always returns True when it tests for the existence of a CGI variable, regardless of whether the browser supports the variable. To determine if the CGI variable is available, test for an empty string, as shown in the following example:

<cfif CGI.varname IS NOT "">
CGI variable exists
CGI variable does not exist
# Posted By Jay Greer | 4/18/07 12:50 AM
Thats true for certain CGI variables eg HTTP_REFERRER but not all CGI variables inc the one I mentioned above in the code.
# Posted By Justin Mclean | 4/18/07 1:16 AM