Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WhatsApp Api on Mobile and Desktop
/**
* 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
You can’t perform that action at this time.