Trigger tweet web intent via javascript



I am trying to get multiple custom links within a page to trigger a tweet intent that will create a card with a custom image unique to each link.

In WordPress with Yoast SEO I can pass a parameter through to the page (which is the URL of the image) and it will set the twitter:image to that image URL.

I need a way to trigger the tweet intent when the link is clicked so I can extract the image path and pass through the url with the image path as a query string.

I have this working for Facebook:

jQuery( ‘.fb-share-image’ ).click(function(e){
var image = jQuery(this).attr(‘href’);

                method: 'share',
                href: jQuery(location).attr('href') + '?og_img=' + image,
            function (response) {


Is there a similar function to the FB.ui methods that I can call a tweet intent and pass through the URL?

Any help very much appreciated thanks.


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.