1

Trying to use "whatsapp" share button along side with Sharrre (http://sharrre.com/).

So far The main idea is this:

see example Please try it on your mobile if you want , of course.

function shareme(shareElementMobile){
$(shareElementMobile).each(function (i) {
    var lnk = $(this).attr('data-url'),
        txt = $(this).attr('data-text'),
        resTxt = encodeURIComponent(txt),
        resLnk = encodeURIComponent(lnk);


    $(this).sharrre({
        share: {
            facebook: true,
            twitter: true,
            linkedin: true
        },
        template: '<ul class="box"><li><h2>{total}  <small>Compartido</small></h2></li><li id="facebook"><i class="fa fa-facebook"></i></li><li id="twitter"><i class="fa fa-twitter"></i></li><li id="linkedin"><i class="fa fa-linkedin"></i></li><li id="whatsapp"><a href="whatsapp://send?text=' + resTxt + ' ' + resLnk + '"><i class="fa fa-whatsapp"></i></a></li></ul>',
        enableHover: false,
        enableTracking: true,
        buttons: {
            facebook: {
                layout: 'button',
                send: true
            },
            twitter: {}
        },
        render: function (api, options) {

            $(api.element).on('click', '#twitter', function () {
                api.openPopup('twitter');
                return false;
            });

            $(api.element).on('click', '#facebook', function () {
                api.openPopup('facebook');
                return false;
            });

            $(api.element).on('click', '#linkedin', function () {
                api.openPopup('linkedin');
                return false;
            });

        }
    });


});
}

shareme('#sharemeMobile');

What happen is that the button of whatsapp doesn't' work at all.

Do I need to separate every social button??

Martin Tournoij
  • 26,737
  • 24
  • 105
  • 146
Locke
  • 629
  • 1
  • 5
  • 21
  • 1
    `whatsapp://` is not a valid protocol, how do you intend to `href` to it? – Shahar Dec 31 '14 at 20:49
  • @Shahar Software you install can register new protocol handlers with a browser. Those browsers *will* understand new URI types. Skype does the same. – Mörre Dec 31 '14 at 20:52
  • 1
    Mörre is right , @Shahar , this is your the answer : http://stackoverflow.com/questions/21935149/sharing-link-on-whatsapp-from-mobile-website-not-application-for-android – Locke Dec 31 '14 at 20:55

1 Answers1

3

I figure it out

I needed to add:

$(api.element).on('click', '#whatsapp', function () {
                api.openPopup('whatsapp');
                return false;
            });

and now everything is working properly .

Locke
  • 629
  • 1
  • 5
  • 21
  • is there any way to share or not ?what i meant is ,do something after sucess sharing -Locke – ubm Apr 19 '17 at 05:35