We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

Web apps zijn apps zijn gemaakt met standaard web technologieën. ze werken bij alle moderne browsers, en kunnen gemaakt worden met je favoriete software. Enkele kenmerken van web van websites zijn: apps zijn geinstaleerd door een gebruiker, ze zijn onafhankelijk, ze hebben niet altijd de mooiheid van de browser nodig en ze kunnen gemaakt zijn om ook zonder internet het te doen. Gmail, twitter en Etherpad zijn web apps.

The Mozilla Open Web Apps project proposes some small additions to existing sites to turn them into apps that run in a rich, fun, and powerful computing environment. These apps run on desktop browsers and mobile devices, and are easier for a user to discover and launch than Web sites. They have access to a growing set of novel features, such as synchronizing across all of a user's devices.

Before you start

If you are a first time developer looking to write web apps then you may want to verify the implementation state of the API.

Publishing the app

The only thing you have to do to create a Web app from a Web site is to add an app manifest. This is a JSON file that describes your app, including its name, its icons, and a human-readable description.

The manifest must be hosted from the same domain as your website, and must be served with a Content-Type of application/x-web-app-manifest+json (Note: this is currently not enforced by Firefox, but it is necessary for the Firefox OS Marketplace). For full details about the manifest refer to the documentation. There are tools to check your manifest for validity. See Validating a manifest.

Same origin policy

It's important to note that each app should be hosted from its own domain. Different apps should not share the same domain. An acceptable solution is to host each app from a different subdomain, for example. See FAQs about apps manifests for more information on origins.

Checking whether the app is installed

When a Web browser loads the app's page, the page needs to handle the case that the user doesn't have the app installed. You can check whether the app is installed by calling getSelf(), like this:

var request = navigator.mozApps.getSelf();
request.onsuccess = function() {
  if (request.result) {
    // we're installed
  } else {
    // not installed
request.onerror = function() {
  alert('Error checking installation status: ' + this.error.message);

Installing the app

You can distribute your app directly from your site. It's also a good idea to test installing from your site, just to make sure your manifest validates, before you submit it to the Firefox OS Marketplace.

Just construct a button or link that invokes this JavaScript:

var request = navigator.mozApps.install("http://path.to/my/example.webapp");
request.onsuccess = function() {
  // great - display a message, or redirect to a launch page
request.onerror = function() {
  // whoops - this.error.name has details

Invoking navigator.mozApps.install() causes the browser to load the manifest (i.e. example.webapp) and ask the user whether to install the application. If the user approves the installation, the app is installed into the browser. On OS X, application will be installed in the "Applications" folder.

The second parameter is an install_data argument to navigator.mozApps.install(), to persist some information into the user's installed-applications data store. This information can be synchronized to their other devices, and can be retrieved by your application using the getSelf() call (see Checking whether the app is installed). For example:

        user_id: "some_user"

Promoting the app

Mozilla is building an app marketplace that takes care of discovery, reviews, ratings, and billing, using an open infrastructure that can be used by other third parties to create their own stores. But you're not required to list your app in a store.

If you want people to pay for your app, see Marketplace payments.

The Firefox OS Marketplace is expected to be available soon. You can also sign up for the Apps Developer newsletter to get news about the progress of the Firefox OS Marketplace, as well as tips and advice on creating apps.

Running offline and using advanced device APIs

Modern Web browsers have added a lot of great features to let your application run offline or access device capabilities. Here are some useful links:

Storing data locally

The localStorage API provides a key-value store of persistent data that you can use to keep track of user data between visits to your app. If the user has a modern browser, such as Firefox 4 or later, or Google Chrome, you can also use IndexedDB, a structured, high-performance client-side datastore.

If you have data that should be shared between instances of your app across all devices that a user uses, then you should use the install_data parameter to the install() function, as described above.


Some examples of open web apps:

See also

Apps developer home page

Documentlabels en -medewerkers

Aan deze pagina hebben bijgedragen: martinidev
Laatst bijgewerkt door: martinidev,