Search code examples
javascripttwittertweets

Custom message with Twitter web intents


I have a Twitter link using web intents so as to use a custom button image:

<a href="https://twitter.com/intent/tweet" data-text="custom data woot">
    <img src="img/twittersm.png"/>  
</a>

that works as a popup as expected, but am trying to compose custom web content for users to tweet with each link. Think of it as being able to tweet comments.

How can I specify data-text="" with Twitter's web intents?

UPDATE: The accepted answer works well thank you. Note that in order for the intent to "popup" in a popup type window you must be using Twitter's JS. Any work arounds would be appreciated.

<script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>

Solution

  • I think you might be looking for the text parameter. For example:

    <a href="https://twitter.com/intent/tweet?text=custom data woot">
        <img src="img/twittersm.png"/>  
    </a>
    

    See the Supported Parameters listed in the tweet intent docs here: https://dev.twitter.com/docs/intents#tweet-intent