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

187
Vistas
How to show an error message if viber sharing is not available?

Say, I'm on desktop, or on Android which has no Viber application. I press it and nothing happens. A notice message ought to be shown, like "Install the Viber application!" or something like that. All I have is this:

<a href="viber://forward?text=text">Click here to share!</a>

I tried these:

<a href="whatsapp://send/?phone=62812345678&amp;text=test" id="openWA">Send to WhatsApp</a>
<br>
<a href="viber://forward?text=paff" id="openV">Send to Viber</a>

<!-- Auto open on WebView and Firefox -->

<script>
    document.querySelector('#openWA').addEventListener('click', function() {
        var f = Date.now(),
            j = setTimeout(function() {
                if (Date.now() - f > 1250)
                    return;
                alert('WA not installed')
            }, 1e3);
    });
    document.querySelector('#openV').addEventListener('click', function() {
        var f = Date.now(),
            j = setTimeout(function() {
                if (Date.now() - f > 1250)
                    return;
                alert('VIBER not installed')
            }, 1e3);
    });
</script>

but it say "not installed", either it is or not.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Try using this

  <a href="#" id="openWA">Send to WhatsApp</a>
<br>
<a href="#" id="openV">Send to Viber</a>

<!-- Auto open on WebView and Firefox -->

<script>
    document.querySelector('#openWA').addEventListener('click', function() {
      setTimeout(() =>{
        alert("Whatsapp not installed")
      }, 500)
      window.location.replace('whatsapp://send/?phone=62812345678&amp;text=test')
            
    });
    document.querySelector('#openV').addEventListener('click', function() {
      setTimeout(() =>{
        alert("Viber not installed")
      }, 500)
      window.location.replace('viber://forward?text=paff')
            
    });
</script>

For more information see this stackoverflow post How to check app is installed or not using javascript

about 4 years ago · Juan Pablo Isaza Denunciar
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