Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add whatsapp Support to js #63

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions dist/js/social-share-kit.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*!
* Social Share Kit v1.0.14 (http://socialsharekit.com)
* Social Share Kit v1.0.15 (http://socialsharekit.com)
* Copyright 2015 Social Share Kit / Kaspars Sprogis.
* @Licensed under Creative Commons Attribution-NonCommercial 3.0 license:
* https://github.com/darklow/social-share-kit/blob/master/LICENSE
* ---
*/
var SocialShareKit = (function () {
var supportsShare = /(twitter|facebook|google-plus|pinterest|tumblr|vk|linkedin|buffer|email)/,
var supportsShare = /(twitter|facebook|google-plus|pinterest|tumblr|vk|linkedin|whatsapp|buffer|email)/,
sep = '*|*', wrap, _wrap;

// Wrapper to support multiple instances per page by selector
Expand Down Expand Up @@ -216,6 +216,9 @@ var SocialShareKit = (function () {
}
};
switch (network) {
case 'whatsapp':
url = 'https://api.whatsapp.com/send?text=' + encodeURIComponent(title + '\n' + shareUrl + '\n\n' + text + '\n');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should use this rather
https://wa.me/?text=

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why ?
https://api.whatsapp.com/send?text=
works as it should be.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I remember correctly this wasn't working on Android or IOS

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i did a test on
https://wa.me/?text=
its redirect to
https://api.whatsapp.com/send?text=
on ios & android

break;
case 'facebook':
url = 'https://www.facebook.com/share.php?u=' + paramsObj.shareUrlEncoded();
break;
Expand Down