Closed decabeza closed 5 years ago
Merge this commit, please
Just released 1.2.0
@huacnlee When using the WhatsApp as it's implemented, the snippet doesn't show and doesn't include the URL. I.e. You have to append the urlencoded URL to the text itself. Because including the URL as a query parameter doesn't work. I'm doing following work around:
//set up the url
var url = "whatsapp://send?text=";
//define the message text
var title = $(document).find("title").text();
var canonical = $("link[rel='canonical']").attr("href");
var text = title + " at " + canonical;
//encode the text
var encodedText = encodeURIComponent(text);
//set the href attribute on the link
$whatsApp_app.attr("href", url + encodedText);
What
This PR adds social share button for WhatsApp in two versions:
whatsapp_app
for mobile version usingwhatsapp://send?text=
whatsapp_web
for desktop browsers usinghttps://web.whatsapp.com/send?text=
Notes
If you wanna use both versions, you should add some extra CSS (media-queries for example) for
.ssb-whatsapp_app
and.ssb-whatsapp_web
classes to show different version depending of device or screen size, to avoid show both at same time and confuse to users.