Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

195
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!