--- url: "https://web.dev/articles/web-apps/contacts/pattern" titulek: "web.dev" h1: "" popis: "" jazyk: "en" kanonicka: "https://web.dev/articles/web-apps/contacts/pattern" drobecky: [] zdroj: "live" wayback_snapshot: "" stazeno: "2026-09-14 01:48:52" znaku: 2967 slov: 345 kodovani: "iso-8859-2" sha256: "d8615901ec733e86e198840129cbab21332381aa2bd750b9ab7007a878b46926" --- Stay organized with collections Save and categorize content based on your preferences. HTML ` How to access contacts from the address book

How to access contacts from the address book

Ship your order as a present to a friend.



 

 

 

 

 

 

 

 

 
 
` CSS `html { box-sizing: border-box; font-family: system-ui, sans-serif; color-scheme: dark light; } *, *:before, *:after { box-sizing: inherit; } body { margin: 1rem; } input { display: block; margin-block-end: 1rem; }` JS `const button = document.querySelector('button'); const name = document.querySelector('.name') const address = document.querySelector('.address') const email = document.querySelector('.email') const tel = document.querySelector('.tel') const pre = document.querySelector('pre') const autofills = document.querySelectorAll('.autofill') if ('contacts' in navigator) { button.hidden = false; for (const autofill of autofills) { autofill.parentElement.style.display = 'none' } address.parentElement.style.display = 'block'; button.addEventListener('click', async () => { const props = ['name', 'email', 'tel', 'address']; const opts = {multiple: false}; try { const [contact] = await navigator.contacts.select(props, opts); name.value = contact.name; address.value = contact.address; tel.value = contact.tel email.value = contact.email; } catch (err) { pre.textContent = `${err.name}: ${err.message}` } }); }` Except as otherwise noted, the content of this page is licensed under the [Creative Commons Attribution 4.0 License](https://creativecommons.org/licenses/by/4.0/), and code samples are licensed under the [Apache 2.0 License](https://www.apache.org/licenses/LICENSE-2.0). For details, see the [Google Developers Site Policies](https://developers.google.com/site-policies). Java is a registered trademark of Oracle and/or its affiliates. Last updated 2026-07-29 UTC.