Created
July 22, 2014 19:00
-
-
Save MarcoDeJong/e8654579ccfeaf0b7e0c to your computer and use it in GitHub Desktop.
Whatsapp share link (or button)
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
<html> | |
<head> | |
<meta name='viewport' content='width=device-width, user-scalable=yes'> | |
</head> | |
<body> | |
<h1>Whatsapp share link</h1> | |
<p>This will currently only work on an iPhone</p> | |
<script> | |
var iOS = /(iPhone)/g.test(navigator.userAgent); | |
if(iOS) { | |
var notice = document.createElement('p'); | |
notice.appendChild(document.createTextNode('Hey, you are on an iPhone ;)')); | |
document.body.appendChild(notice); | |
} | |
</script> | |
<a href="javascript:window.location='whatsapp://send?text='+encodeURIComponent(location.href);">Share this page</a> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment