Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Veröffentlichungsoptionen Ihrer App

Once you have finished your app, you need to deploy it and publish it. This involves making it available for users to consume (whether they are going to just navigate to it in a browser and use it like a regular web page, or download it and install it on a device like a Firefox OS phone.), letting people know it is available, and providing supporting information such as usage instructions and help resources. This article looks briefly at the options available to you.

Publishing on the Firefox Marketplace

The Firefox Marketplace is our own dedicated app store for distributing free and paid apps. Submitting an app to the Firefox Marketplace is a simple process, involving uploading the app itself plus surrounding information, and waiting for it to go through our thorough review process to make sure it is high quality and not malicious. Submitting to the Firefox Marketplace also confers other advantages such as increased publicity, no need to implement special APIs on your own web site, and the possibility of publishing paid apps more easily. You can submit both hosted apps and packaged apps to the Firefox Marketplace.

Hosted apps

A hosted app is basically an app hosted on a web server just like a regular web page. If you want to let people install a hosted app straight from the site, you must implement some JavaScript code on your Web site to manage installing and updating your app into users' browsers, and make sure your app code includes a valid manifest file. Please see our writeups of manifest files and Install API functionality for how simple these steps are to implement.

Where you host the app is really up to you, but the two options listed below are probably the most common and easiest.

GitHub

If the Web app is purely static (HTML/CSS/JavaScript, but no server-side processing), GitHub Pages is a solid hosting option. It will serve your manifest with the correct MIME type if you give it a .webapp extension.

Generic hosting solutions

For dynamic websites, use a generic hosting option (like a Web server you may already own or have access to) with the right capabilities or a hosting provider specifically tailored to the needs of your app, like Heroku or Google App Engine.

Note: Installable open web apps have a "single app per origin" security policy; basically, you can't host more than one installable app per origin. This makes testing a bit more tricky, but there are still ways around this, such as creating different sub-domains for apps, testing them using the Firefox OS Simulator, or testing the install functionality on Firefox Aurora/Nightly, which allow installable web apps to install on the desktop. See FAQs about apps manifests for more information on origins.

Packaged apps

A packaged app is an Open Web App that has all of its resources (HTML, CSS, JavaScript, app manifest, and so on) contained in a zip file, instead of having its resources on a Web server. A packaged app is simply a zip file with the app manifest in its root directory. The manifest must be named manifest.webapp.

One difference from a hosted app is that a packaged app must specify a launch_path in the manifest, whereas it's an optional manifest field for a hosted app. For more information, check out our Packaged Apps article.

Self-publishing apps

You can also choose to self-publish apps. For hosted apps, this just involves putting them up on web hosting, as detailed above.

You can self-publish a packaged app by hosting it on a server along with a mini-manifest in the same directory that identifies the app and is used in the install process. Let's run through this process:

  1. Have your packaged app's zip file available and give it the name package.zip. This file contains all the app's resource files, including the manifest.
  2. Create a file called package.manifest and give it the contents below. This is a mini-manifest used for packaged app installation purposes. It is not the main manifest of your app that is inside the zip file.
    {
        "name": "My sample app",
        "package_path" : "https://my-server.com/my-app-directory/my-app.zip",
        "version": "1",
        "developer": {
            "name": "Chris Mills",
            "url": "https://my-server.com"
        }
    }
  3. Create a file named index.html with the following contents. This contains sample JavaScript that calls the packaged app (installPackage()) and callbacks for success and failure notification.
    <html>
      <body>
        <p>Packaged app installation page</p>
        <script>
          // This URL must be a full url.
          var manifestUrl = 'https://my-server.com/my-app-directory/package.manifest';
          var req = navigator.mozApps.installPackage(manifestUrl);
          req.onsuccess = function() {
            alert(this.result.origin);
          };
          req.onerror = function() {
            alert(this.error.name);
          };
        </script>
      </body>
    </html>
  4. Copy package.zip, package.manifest, and index.html into your app root directory (my-app-directory in my examples).
  5. Using a compatible device (such as a Firefox OS phone), navigate to the location on your server where you put the example files and confirm the prompt to install the app. The script will give an indication of installation success or failure.

Note: You can't install privileged or certified apps from self-hosted packages, as they need to be signed via the Firefox Marketplace submission process.

Note: You can even create your own apps store, which has a number of options available to it.

 

Schlagwörter des Dokuments und Mitwirkende

 Mitwirkende an dieser Seite: ranukanu, teoli, schuko2304
 Zuletzt aktualisiert von: ranukanu,