The Contact Picker API: Fast, private access to a user’s address book

The Contact Picker API lets web apps on supported mobile browsers open the device’s native contact chooser so users can quickly share specific contact details—like name, phone, email, address, and avatar—without granting blanket access to their entire address book.

Key benefits

Availability and constraints

				
					<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Contact Picker API Demo</title>
    <link href="style.css" rel="stylesheet">
    <script src="contactPickerAPI.js" defer></script>
</head>

<body>
    <h1>Contact Picker API Demo</h1>
    <p>
        <strong>Note:</strong> This demo only works on Chrome for Android (or compatible browsers on Android).<br>
        It will <em>not</em> work on desktop browsers.
    </p>
    <button id="pickContactBtn">Pick a Contact</button>
    <h2>Selected Contact:</h2>
    <pre id="output">(none yet)</pre>
</body>

</html>
				
			
				
					body {
    font-family: sans-serif;
    margin: 2em;
}

button {
    font-size: 1.2em;
    padding: 0.5em 1em;
}

pre {
    background: #f4f4f4;
    padding: 1em;
    border-radius: 5px;
}
				
			
				
					// Get references to the button and output area
const pickContactBtn = document.querySelector('#pickContactBtn');
const output = document.querySelector('#output');

// Function to handle contact picking
const pickContact = async () => {
	// Check if the Contact Picker API is available in this browser
	if ('contacts' in navigator && 'ContactsManager' in window) {
		try {
			// Define which fields you want to request from the contact
			const props = ['name', 'email', 'tel', 'address', 'icon'];
			// Options: allow picking only one contact (multiple: false)
			const opts = { multiple: false };

			// Open the contact picker and wait for the user's selection
			const contacts = await navigator.contacts.select(props, opts);

			// Display the selected contact(s) in the output area
			if (contacts.length > 0) {
				output.textContent = JSON.stringify(contacts[0], null, 2);
			} else {
				output.textContent = '(No contact selected)';
			}
		} catch (err) {
			// Handle errors (e.g., user cancels, permission denied)
			output.textContent = 'Error: ' + err.message;
		}
	} else {
		// API not supported in this browser
		output.textContent =
			'Contact Picker API not supported on this browser/device.';
	}
};

// Attach the function to the button's click event
pickContactBtn.addEventListener('click', pickContact);

				
			

In short, the Contact Picker API brings a secure, consent-based bridge between the web and a user’s contacts, dramatically improving mobile form UX while respecting privacy.

more posts:
Online video streaming platform and digital content management concept with media player interface, cloud library, and multimedia files on laptop, representing content distribution, video marketing
Code

Breaking into the Pipeline: Real-Time Frame Manipulation with the Insertable Streams for MediaStreamTrack API

The experimental Insertable Streams for MediaStreamTrack API closes a long-standing gap in web multimedia by treating live camera feeds as standard Web Streams. By piping individual VideoFrame objects through a TransformStream and recording the transformed output via MediaRecorder, developers can execute frame-by-frame processing—like real-time filtering, watermarking, and computer vision overlays—without relying on hidden canvas hacks.

Discover More »
Apps & Custom Software

What Building Our Own App Taught Us About Building Yours

When Hess WebTech built and launched Tericipe—an Android app that turns printed recipes into a searchable digital collection—in under three months, we had to live with every decision we usually advise clients on. From testing against real-world messy data and handling AI uncertainty to server-side payment security and post-launch maintenance, here are five crucial lessons from our own build that apply to almost any software project.

Discover More »