Wednesday, September 3, 2008

Supporting Google Chrome with Browserhawk

Lottery Post uses Browserhawk (from Cyscape) to detect browser capabilities, so if a user's web browser does not meet the minimum standards required by the site, they can be shown a detailed message page, with a description of exactly what is under-functional.

When the new Google Chrome Web browser was released in the past week, Browserhawk did not detect the new browser properly (and still does not), so users of the new browser had problems logging in to the site.

Since Chrome uses the Apple WebKit open source codebase as its foundation, Browserhawk mistakenly detected the browser as Safari 1.0.

To remedy the situation — at least until Cyscape updates their browser definitions — I have re-programmed the main browser definition file to detect the Chrome browser as Safari 3.1.  (Under the covers the Chrome rendering engine is Safari 3.1.)

For anyone else who uses Browserhawk for browser detection, adding Chrome to the browser definitions is fairly straight-forward:

  1. Open the Browserhawk Editor.
  2. Select File, Open..., and then select maindefs.bdf and click Open.
  3. Right-click on the Safari folder (in the left folder/browser list), and click Add... in the context menu.
  4. In Browser Description enter Chrome.
  5. In Identifying user agent string enter Mozilla/*AppleWebKit/[5-9][0-9][0-9]*Chrome*Safari*.
  6. Click OK.
  7. Change Majorver to 3.
  8. Change Minorver to 1.
  9. Change Version to 3.1.
  10. Change Fullversion to 3.1.
  11. Make sure the rest of the properties match the properties in the Safari v3 entry by clicking back and forth between Chome and Safari v3 — except for the last two properties.
  12. Set Versionposx to 0 [zero].
  13. Set Versionposstr to an empty string.
  14. Click the Save icon in the editor toolbar to finish the process.

To test to be sure Chrome is being properly identified as Safari 3.1, go to www.mybrowserinfo.com and click on See Detailed Location and Browser Information.

In addition to seeing that it is correctly identified, also be sure cookies and JavaScript are being detected as "enabled".