Can a website (HTML5,JavaScript) access a mobile device's (android/iPhone) contact list, SDCard files

后端 未结 8 1217
春和景丽
春和景丽 2020-12-10 10:58

Can a website (HTML5,JavaScript) access a mobile device\'s (android/iPhone)
contact list, SDCard files? A website as in one opened in a browser not a phonegap applicatio

8条回答
  •  离开以前
    2020-12-10 11:29

    Chrome has since shipped their own version of a "Contact Picker" HTML5 API in Chrome 80: https://web.dev/contact-picker.

    Chrome only: it is not a W3C Standard nor is it on the W3C Standards Track.

    selectRecipientsButton.addEventListener('click', async () => {
      const contacts = await navigator.contacts.select(['name', 'email'], {multiple: true});
    
      if (!contacts.length) {
        // No contacts were selected in the picker.
        return;
      }
    
      // Use the names and e-mail addresses in |contacts| to populate the
      // recipients field in the website’s UI.
      populateRecipients(contacts);
    });
    

提交回复
热议问题