Web APIs
Web APIs provide access to native device and platform functionalities to the web apps via JavaScript.
These Web APIs are standardized by W3C, therefore are in-built in the web browsers.
There are a large number of Web APIs available. You can learn about them at https://developer.mozilla.org/en-US/docs/Web/API
Nectar provides demo for a number of useful Web APIs which are commonly used in PWAs.
You can check them at https://nectar.website/demo/web-apis/
Not all the Web APIs are supported by every browser, therefore it is necessary to check if a particular Web API is supported on the targeted browser platform.
We have provided a helper utility function to check the Web API for browser support. You can find the code in /assets/custom/js/init.js
file, inside app.support.webApi = {}
object.
In case, the Web API is not supported on your targeted browser platform, you should provide a proper fallback for that by using some third-party library or polyfill.
Most of the Web APIs also work in Cordova, as Cordova uses WebViews. In case they do not work, you can always use Cordova-specific plugins for that.
Last updated