Skip to content

Instantly share code, notes, and snippets.

@abidvf
Last active August 18, 2016 11:23
Show Gist options
  • Save abidvf/3909c3656dfd500ef26d35a621e316b5 to your computer and use it in GitHub Desktop.
Save abidvf/3909c3656dfd500ef26d35a621e316b5 to your computer and use it in GitHub Desktop.
<script>
$(document).ready(function(){
var text = 'I need help with tech support'
if(detectmob()) {
if (/iphone/i.test(navigator.userAgent.toLowerCase()) ){
Intercom('hide');
$('.widget-container:contains(Get Started) a').attr("href", "sms:234234234234&body=" + encodeURIComponent(text))
$('.widget-container:contains(Get Started) a').click(function(e){
e.preventDefault();
Intercom('show');
});
}
}
function detectmob() {
if( navigator.userAgent.match(/Android/i)
|| navigator.userAgent.match(/webOS/i)
|| navigator.userAgent.match(/iPhone/i)
|| navigator.userAgent.match(/iPad/i)
|| navigator.userAgent.match(/iPod/i)
|| navigator.userAgent.match(/BlackBerry/i)
|| navigator.userAgent.match(/Windows Phone/i)
){
return true;
}
else {
return false;
}
}
})
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment