Search code examples
twitter

How do I write a correct twitter web intent?


I want to embed a tweet button on a webpage with a text an url but no original referrer. I've been trying with this:

<a class="twitter-share-button"
  href="https://twitter.com/intent/tweet?text=Hello%20world" url="www.something.com">
Tweet</a>

But I each time end up with the name and url of my web page in the tweet. What's the correct syntax for what I want to do? Thanks.


Solution

  • The url parameter should be part of the Twitter intent (like text):

    <a class="twitter-share-button"
      href="https://twitter.com/intent/tweet?text=Hello%20world&url=www.something.com">
    Tweet</a>
    

    Check the documentation for web intents.