我们的志愿者还没有将这篇文章翻译为 中文 (简体)。加入我们帮助完成翻译!
您也可以阅读此文章的English (US)版。
Non-standard
This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.
The InstallTrigger
interface is an interesting outlier in the Apps API; it's included in this API but are inherited from the old Mozilla XPInstall technology for installing add-ons. It is used for triggering the download and installation of an add-on (or anything packaged in an .xp
i file) from a Web page, using JavaScript code to kick off the install process.
Note: This article needs to be updated somewhat.
Overview
For very simple installations, the install methods on the InstallTrigger
object may be all that's needed in the installation script.
For more complex installations, you may need to use the Install and/or File installation objects. In either case, you must trigger the installation process by creating a web page script in which InstallTrigger methods download the specified XPI file and "trigger" the execution of the install.js script at the top level of that XPI.
The principal method on the InstallTrigger object is install, which downloads and installs one or more software packages archived in the XPI file format. The following is a basic example of an install trigger on a web page:
xpi={'XPInstall Dialog Display Name':'simple.xpi'}; InstallTrigger.install(xpi);
You can also use the InstallTrigger object to install Netscape 6/Mozilla skins and language packs, and perform multiple-package installations with install.
- compareVersion
- Compares the version of a file or package with the version of an existing file or package.
- enabled
- Indicates whether or not Software Installation is enabled for this client machine.
- getVersion
- Returns an object representing the version number from the Client Version Registry for the specified component. It is used in both trigger scripts and installation scripts.
- install
- Installs one or more XPI files on the local machine.
- installChrome
- Installs new skin or locale packages in Netscape 6 and Mozilla.
- startSoftwareUpdate
- Triggers the downloading and installation of the software at the specified URL.