Last active
August 18, 2016 11:23
-
-
Save abidvf/3909c3656dfd500ef26d35a621e316b5 to your computer and use it in GitHub Desktop.
This file contains 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
<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