Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

318
Vistas
Share a vcard (.vcf file) using the web share API

I'm trying to add a contact to a phone, by sharing a vcard (.vcf file) using the web share API, but its not working on android. It works just on my iPhone. Any idea about why its not working on android?

<html>
<title>
    Web Share API
</title>

<body>
    <div>
        <div>
            <button onclick="shareVcard" id="shareFilesButton">Share Files</button>
        </div>
    </div>
</body>
<script>
    document.getElementById('shareFilesButton').addEventListener("click", () => shareVcard())

function shareVcard() {
fetch("sample.vcf")
.then(function(response) {
    return response.text()
  })
.then(function(text) {

    var file = new File([text], "sample.vcf", {type: 'text/vcard'});
    var filesArray = [file];
    var shareData = { files: filesArray };


    if (navigator.canShare && navigator.canShare(shareData)) {

    // Adding title afterwards as navigator.canShare just
    // takes files as input
    shareData.title = "vcard";

    navigator.share(shareData)
    .then(() => console.log('Share was successful.'))
    .catch((error) => console.log('Sharing failed', error));

    } else {
    console.log("Your system doesn't support sharing files.");
    }
 
});
    }
</script>

</html>

about 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda