shadows wrote:

> Hi,
> Can anyone tell me how I do a Mozilla Version check in my Install Script?
> All I have to do is check if the installed client is Netscape 6.1 or 6.0 and
> if the OS running is windows...
> Can anyone help me?


Check (typeof buildID == "undefined"). If true then it's 6.0 (or a similarly 
old version of Mozilla). If false then use the buildID to determine what 
build your script is running on.  It will match the "Gecko" version from an 
unspoofed useragent (it's not affected by spoofing).

If it is undefined don't try to access its value, a js exception will be 
thrown and abort your script.

Similarly there is the "platform" property you can use, which was also 
probably not implemented in 6.0. If you need something that will work on old 
and new versions then you can try the getFolder() trick. Try to get a folder 
object for a platform-specific target, if the return value is non-null then 
you're on that platform. For example:

     var isWin = ( getFolder("Windows") != null );
     var isMac = ( getFolder("Mac System") != null );
     var isUnix = ( getFolder("Unix Local") != null );

You may be misled by this trick on Mac OS X since the traditional mac 
folders don't currently work. (there's a bug filed, but it's being argued 
whether it really is a bug since macosx is different.) Since we didn't ship 
a macosx build in 6.0 you should try for the platform property first and use 
this trick only if that's not defined. Or set isMac to (!isWin && !isUnix).

-Dan Veditz



Reply via email to