Progressive Web Apps (PWAs) have evolved into one of the most powerful platforms in modern web development. With enhanced access to native device features, PWAs are now able to deliver near-native experiences straight from the browser — without requiring an app store download.
As browsers continue to support a growing list of APIs, developers can now build fast, reliable, and engaging web apps that can rival traditional mobile apps. Below is a breakdown of essential PWA APIs that every modern app should consider integrating:
Built-in APIs with Liteit.app
Liteit.app provides a suite of ready-to-use APIs that extend the power of your PWA without writing complex backend code. These APIs are designed to help you control app behavior, handle installation events, detect device context, and more.
install()
– Triggers the PWA installation prompt.onInstall()
– Callback for when the app is successfully installed.openApp()
– Programmatically opens the PWA if installed.getLocation()
– Fetches the user’s geolocation in a privacy-compliant way.isInstalled()
– Checks whether the app is currently installed.isInApp()
– Detects if the app is running in standalone PWA mode.pushBanner()
– Displays a banner to encourage enabling notifications.isPushGranted()
– Checks if push notification permissions are granted.browserIs()
– Returns the name of the user’s browser.osIs()
– Detects the operating system (iOS, Android, Windows, etc.).isPrivate()
– Detects if the user is in incognito/private mode.player()
– Controls embedded media playback.share()
– Triggers the device-native share menu.isMob()
– Detects if the device is mobile.isPwable()
– Determines if the current environment supports PWA installation.isOnline()
– Checks if the user is currently connected to the internet.
Available Web APIs for PWAs
- Cookies API:
Manage session data and user preferences for a seamless experience across visits. - Installation API:
Allow users to install your app to their device like a native app. - Offline Support:
Enable full or partial access to your app even without internet using Service Workers. - Notifications API:
Send timely push notifications to engage users and improve retention. - Declarative Web Push:
Simplify push notification setup using manifest declarations. - Shortcuts API:
Add app-specific shortcuts to home screen context menus. - View Transitions API:
Smooth transitions between UI states or pages. - Geolocation API:
Access the user’s location for local search, maps, or location-aware features. - Media Capture API:
Record audio, video, or images using the device’s hardware. - Picture-in-Picture API:
Play videos in a floating window while users navigate other content. - Camera API:
Capture photos or stream video directly in the browser. - Microphone API:
Enable voice input or real-time audio features through the browser. - Audio Recording API:
Record and manage sound from the user’s microphone. - Audio API:
Process and analyze audio streams for playback, effects, or streaming. - Audio Session API:
Manage audio focus and playback sessions across tabs or apps. - Clipboard API:
Read from or write to the clipboard for copy-paste features. - Screen Capture API:
Capture screen or window content for collaboration or streaming. - Element Capture API:
Capture visual output from specific DOM elements. - Bluetooth API:
Connect to nearby Bluetooth-enabled devices like smartwatches and sensors. - NFC API:
Read/write data via near-field communication for contactless interactions. - AR/VR (WebXR):
Build immersive augmented or virtual reality experiences in the browser. - Storage Access API:
Store structured or large data using localStorage, IndexedDB, or File System. - File System API:
Access and manipulate files directly from the user’s device with permission. - File Handling API:
Allow your app to open and edit specific file types from the OS or drag-drop. - Contact Picker API:
Let users select contacts securely from their address book. - Web Share API:
Trigger the native share sheet for links, files, or text content. - Barcode Detection API:
Scan barcodes using the camera for logistics, shopping, or access control. - Face Detection API:
Detect facial landmarks for camera effects, filters, or AR experiences. - Vibration API:
Provide tactile feedback through device vibration. - Authentication API:
Use device credentials (biometrics or PIN) to authenticate users securely. - Protocol Handling API:
Let your PWA handle specific link types or custom URL schemes. - Background Sync API:
Retry failed requests or updates once connectivity is restored. - Background Fetch API:
Download large files even when the app isn’t actively open. - Payment Request API:
Provide a native-feeling checkout experience directly in the browser. - Wake Lock API:
Prevent the screen from sleeping during critical tasks (e.g., presentations). - Device Orientation API:
Detect orientation for immersive layouts or motion controls. - Device Motion API:
Access accelerometer and gyroscope data for movement-based interactions. - Network Information API:
Detect connection type (Wi-Fi, 4G, offline) and adjust app behavior. - Speech Synthesis API:
Convert text to voice to improve accessibility or narration features. - Speech Recognition API:
Turn spoken input into text for search, commands, or dictation. - Multi-Touch Support:
Handle complex touch gestures like pinch, swipe, and rotate.
All of these features are documented at https://liteit.app/js-api.html, making it easy to bring PWA functionality to your app in minutes.
๐ Push Notifications Across Devices & OS
Push notifications are a core feature of modern Progressive Web Apps, enabling real-time communication and user engagement — even when the app isn't actively open. With support across major platforms like Android, Windows, Chrome, and Edge, PWAs can deliver notifications that behave just like native app alerts.
While iOS now offers limited PWA notification support (iOS 16.4+), full functionality is available on most other devices, making push a powerful tool for cross-platform engagement.
To see how PWA push notifications work in real-time across different devices and browsers, visit our live demo page:
https://liteit.app/push-notifications.html?demos
Conclusion
PWA APIs open up a world of possibilities for web developers. With access to device hardware, native UI prompts, and smart app behaviors, the line between websites and apps is rapidly fading. Tools like Liteit.app simplify the process by offering pre-built integrations and API wrappers — so you can focus on delivering value and user experience.
JavaScript Examples for PWA APIs
๐ Cookies API
document.cookie = "username=John; path=/; max-age=3600";
console.log(document.cookie);
Stores and retrieves simple user preferences.
๐ Geolocation API
navigator.geolocation.getCurrentPosition(position => {
console.log(position.coords.latitude, position.coords.longitude);
});
Fetches the user’s location (with permission).
๐ Notifications API
Notification.requestPermission().then(permission => {
if (permission === "granted") {
new Notification("Hello!", { body: "This is a web notification." });
}
});
Triggers browser notifications after user permission.
๐ผ️ Media Files (File Upload & Preview)
<input type="file" accept="image/*" onchange="previewFile(this)">
<img id="preview">
function previewFile(input) {
const file = input.files[0];
const reader = new FileReader();
reader.onload = e => document.getElementById("preview").src = e.target.result;
reader.readAsDataURL(file);
}
Allows image upload and preview before submission.
๐ท Camera API
<video autoplay playsinline></video>
navigator.mediaDevices.getUserMedia({ video: true }).then(stream => {
document.querySelector("video").srcObject = stream;
});
Streams live video from the device camera.
๐️ Microphone API
navigator.mediaDevices.getUserMedia({ audio: true }).then(stream => {
console.log("Microphone access granted");
});
Enables microphone access for voice recording or chat.
๐ Clipboard API
navigator.clipboard.writeText("Copied from PWA!");
navigator.clipboard.readText().then(text => {
console.log("Clipboard contains:", text);
});
Reads and writes to the user's clipboard.
๐บ Screen Capture API
<video autoplay></video>
navigator.mediaDevices.getDisplayMedia().then(stream => {
document.querySelector("video").srcObject = stream;
});
Captures and displays the user’s screen.
๐ Bluetooth API
navigator.bluetooth.requestDevice({ acceptAllDevices: true }).then(device => {
console.log("Connected to:", device.name);
});
Scans for and connects to nearby Bluetooth devices.
๐พ Storage Access API
localStorage.setItem("theme", "dark");
console.log(localStorage.getItem("theme"));
Stores simple key-value data in the browser.
๐ณ Payments API
const payment = new PaymentRequest([{
supportedMethods: "basic-card"
}], {
total: { label: "Total", amount: { currency: "USD", value: "9.99" } }
});
payment.show();
Triggers a secure, native-style payment prompt.
๐ก Sensors API (Device Orientation)
window.addEventListener("deviceorientation", event => {
console.log("Alpha:", event.alpha, "Beta:", event.beta, "Gamma:", event.gamma);
});
Accesses motion/orientation sensor data from the device.
๐ณ Vibration API
navigator.vibrate([200, 100, 200]);
Triggers vibration patterns on supported mobile devices.
๐ฅ Installation API
window.addEventListener('beforeinstallprompt', (e) => { e.preventDefault(); e.prompt(); });
Triggers the PWA installation prompt manually.
๐ก Offline Support (Service Worker)
self.addEventListener('fetch', event => { event.respondWith( caches.match(event.request).then(response => response || fetch(event.request)) ); });
Serves cached responses when the device is offline.
๐ฌ Declarative Web Push (Manifest)
// Add to manifest.json: { "gcm_sender_id": "103953800507" }
Registers your app for push notifications with Firebase automatically.
๐งญ Shortcuts API
// Add to manifest.json: "shortcuts": [ { "name": "Open Chat", "url": "/chat", "icons": [{ "src": "/icons/chat.png", "sizes": "192x192" }] } ]
Adds long-press quick actions on home screen app icons.
๐ View Transitions API
document.startViewTransition(() => { document.body.innerHTML = "New Page
"; });
Enables smooth transitions between visual states.
๐ธ Media Capture API
navigator.mediaDevices.getUserMedia({ video: true, audio: true }) .then(stream => console.log("Stream started", stream));
Accesses the user's camera and microphone.
๐ผ️ Picture-in-Picture
const video = document.querySelector('video'); video.requestPictureInPicture();
Plays video in a floating window above all apps.
๐ File System Access API
const fileHandle = await window.showSaveFilePicker(); const writable = await fileHandle.createWritable(); await writable.write("Hello, LIA!"); await writable.close();
Allows direct saving of files from the browser to the user's device.
๐ Authentication API (WebAuthn)
navigator.credentials.get({ publicKey: { challenge: new Uint8Array([/* challenge here */]), allowCredentials: [], timeout: 60000, userVerification: "preferred" } });
Initiates biometric or secure device login authentication.
๐ฆ Protocol Handling API
navigator.registerProtocolHandler( "web+myapp", "https://example.com/?url=%s", "My Custom Handler" );
Registers your app to handle custom URL schemes.
๐ File Handling API
// manifest.json "file_handlers": [{ "action": "/open-file", "accept": { "application/json": [".json"] } }]
Lets your PWA open files directly via drag & drop or OS "Open With."
๐ Contact Picker API
const contacts = await navigator.contacts.select(['name', 'email'], { multiple: false }); console.log(contacts);
Allows the user to pick contacts from their device securely.
๐ค Web Share API
navigator.share({ title: "Check this out!", text: "Amazing PWA tool from Liteit", url: "https://liteit.app" });
Triggers the native sharing dialog from the browser.
๐ Barcode Detection API
const barcodeDetector = new BarcodeDetector({ formats: ['qr_code'] }); const barcodes = await barcodeDetector.detect(document.querySelector('img')); console.log(barcodes);
Scans barcodes or QR codes from images or video.
๐ Face Detection API
const faceDetector = new FaceDetector(); const faces = await faceDetector.detect(document.querySelector('img')); console.log(faces);
Detects faces in images using the browser.
๐️ Audio Recording API
navigator.mediaDevices.getUserMedia({ audio: true }).then(stream => { const recorder = new MediaRecorder(stream); recorder.start(); });
Records audio from the user's microphone.
๐ Audio API (Web Audio)
const ctx = new AudioContext(); const oscillator = ctx.createOscillator(); oscillator.type = "sine"; oscillator.frequency.setValueAtTime(440, ctx.currentTime); oscillator.connect(ctx.destination); oscillator.start();
Generates or processes sound using the Web Audio API.
๐ง Audio Session API
navigator.mediaSession.metadata = new MediaMetadata({ title: "Now Playing", artist: "Liteit FM" });
Integrates with the device’s audio controls and notifications.
๐ฅ️ Screen Capturing API
navigator.mediaDevices.getDisplayMedia().then(stream => { document.querySelector("video").srcObject = stream; });
Lets users share or record their screen content.
๐ฏ Element Capture API
const videoTrack = document.querySelector("#element").captureStream().getVideoTracks()[0];
Captures the visual output of a specific DOM element.
๐ถ Background Sync API
navigator.serviceWorker.ready.then(sw => { sw.sync.register("sync-tag"); });
Ensures actions like form submissions are retried when back online.
⬇️ Background Fetch API
registration.backgroundFetch.fetch("big-download", ["/large-file.zip"], { title: "Downloading...", });
Fetches large files in the background even after leaving the page.
๐พ Storage API
navigator.storage.estimate().then(result => { console.log(`Used: ${result.usage}, Quota: ${result.quota}`); });
Estimates available and used local storage space.
๐ก NFC API
const reader = new NDEFReader(); await reader.scan(); reader.onreading = event => console.log(event.message);
Reads data from NFC tags using compatible devices.
๐ถ️ AR/VR (WebXR)
if (navigator.xr) { navigator.xr.requestSession("immersive-vr").then(session => { console.log("WebXR session started", session); }); }
Launches virtual or augmented reality sessions in supported browsers.
๐ Wake Lock API
const lock = await navigator.wakeLock.request("screen");
Prevents the device screen from dimming or locking.
๐ฑ Device Orientation API
window.addEventListener("deviceorientation", event => { console.log(event.alpha, event.beta, event.gamma); });
Detects how the device is rotated or tilted.
๐ Device Motion API
window.addEventListener("devicemotion", event => { console.log(event.accelerationIncludingGravity); });
Reads movement data from the device’s accelerometer.
๐ Network Information API
console.log(navigator.connection.effectiveType);
Determines the current network type (e.g., 4g, wifi).
๐ฃ️ Speech Synthesis API
const msg = new SpeechSynthesisUtterance("Hello from Liteit"); speechSynthesis.speak(msg);
Converts text into spoken voice using built-in speech engines.
๐ฃ️ Speech Recognition API
const recognition = new webkitSpeechRecognition(); recognition.onresult = event => console.log(event.results[0][0].transcript); recognition.start();
Captures voice input and converts it to text.
๐ค Multi-touch (Pointer Events)
element.addEventListener("pointerdown", e => { console.log("Pointer:", e.pointerId, "Type:", e.pointerType); });
Detects touch gestures and pointer events from fingers or styluses.