Created
May 16, 2019 12:29
-
-
Save arturmamedov/3152980d8aa74e0116e3bb8ed88542a7 to your computer and use it in GitHub Desktop.
WhatsApp Api on Mobile and Desktop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Replace mobile URL of WhatsApp with Desktop | |
* The mobile first strategy is used cause most people decide to not show WhatsApp on Desktop but only on mobile where it is very useful | |
* | |
* @dependencies [ core/w-ismobile.js ] | |
*/ | |
if(withOptions.whatsappWeb && !jQuery.browser.mobile && $(".whatsapp-weburl").length > 0){ | |
clog('WhatsApp Enabled and Present'); | |
clog($(".whatsapp-weburl")); | |
var mobile_wa = $(".whatsapp-weburl").attr('href').replace('?text=', '&text'); | |
mobile_wa = mobile_wa.replace('https://wa.me/', 'https://web.whatsapp.com/send?phone=+39') | |
$(".whatsapp-weburl").attr('href', mobile_wa); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also see my withfront Tools: https://github.com/arturmamedov/withFront/blob/master/js/social/w-whatsapp.js
PHP solution https://medium.com/@jeanlivino/how-to-fix-whatsapp-api-in-desktop-browsers-fc661b513dc