Skip to content

Instantly share code, notes, and snippets.

@arturmamedov
Created May 16, 2019 12:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arturmamedov/3152980d8aa74e0116e3bb8ed88542a7 to your computer and use it in GitHub Desktop.
Save arturmamedov/3152980d8aa74e0116e3bb8ed88542a7 to your computer and use it in GitHub Desktop.
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