Documenting Picasa

Providing documentation on Picasa and Picasa Web Albums - photo organization software and services from Google.

Monday, August 07, 2006

Detecting if Picasa is installed, from a web page

It's possible to detect, from a web page, whether the client machine has Picasa installed or not. Picasa Web Album uses such detection code, so that it can know whether to offer such features as "download album to Picasa" which only makes sense if the client has the application installed.

Detecting Picasa in Firefox and Mozilla

This is achieved by checking the mime types installed on the system. When Picasa is installed, it registers some new mime types.

<script type="text/javascript">
var _picasaInstalled = !!(navigator.mimeTypes['application/x-picasa-detect'] || navigator.mimeTypes['application/x-picasa']);
</script>


I'm not sure why the !! double negation appears in this expression, but that's how its currently written - perhaps it's to avoid problems in certain browsers that I've not come across.

Detecting Picasa in Internet Explorer

This is achieved via the use of IE conditional comments:

<!--[if gte Picasa 2.0]>
<script type="text/javascript">
_picasaInstalled = true;
</script>
<![endif]-->


It looks at first glance as if this could be used to distinguish which version has been installed, but Picasa 2.5 beta still sets the Picasa variable being tested in the condition to the value 2, not 2.5.

Labels:

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home