Skip to content

Instantly share code, notes, and snippets.

@DanielMarquard
Created May 8, 2015 07:42
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 DanielMarquard/7e259b662cdc0d8789df to your computer and use it in GitHub Desktop.
Save DanielMarquard/7e259b662cdc0d8789df to your computer and use it in GitHub Desktop.
Change website share link to tweet from native iPhone Twitter app
<a id="smart-tweet-button" href="https://twitter.com/intent/tweet?text=For%20a%20better%20%23UX,%20let%20mobile%20website%20visitors%20tweet%20with%20the%20Twitter%20iPhone%20app.%20http://netidy.co/1KoZ1Pb%20via%20%40Netidy" target="_blank">Tweet</a>
<script type="text/javascript">
if (navigator.userAgent.match(/(iPhone|iPad|iPod)/g)) {
document.getElementById('smart-tweet-button')
.href="twitter://post?message=For%20a%20better%20%23UX,%20let%20mobile%20website%20visitors%20tweet%20with%20the%20Twitter%20iPhone%20app.%20http://netidy.co/1KoZ1Pb%20via%20%40Netidy";
document.getElementById('smart-tweet-button')
.target="_self";
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment