Open In App

How to display latest tweets from a twitter account using HTML ?

Improve
Improve
Like Article
Like
Save
Share
Report

In this article, we will see how to display the tweets of any user on our web page using HTML.

Twitter is one of the popular social media platforms. It is an American social networking service on which users can post and interact with messages called “tweets”. only registered users can tweet, like, and retweet others’ tweets, but unregistered users can also read those tweets which are publicly available. Everyone wants to display their tweets on their blogging websites. So, In this article, we are going to discuss how can we display someone’s tweet on our website in the easiest way with the help of HTML.

Approach: Below is the step-by-step implementation.

Step 1: Visit https://publish.twitter.com/

  • Enter the profile link to whom you want to show tweets. ex – https://twitter.com/geeksforgeeks

Enter URL

Step 2: After that, a new page will pop up here click on Embedded Timeline.

Choose Embedded Timeline

Step 3: Then you will get your HTML code and a preview of account tweets. copy that HTML Code.

Preview

  • It will look the same as the below code but there will be a change in the href value.
  • You can also use this code and change the href value to your profile’s account url.

Syntax:

<a class="twitter-timeline" 
    href="https://twitter.com/geeksforgeeks?ref_src=twsrc%5Etfw">
    <!-- In your code value of href tag will be changed -->
    Tweets by Geeksforgeeks
</a>

<script async src=
"https://platform.twitter.com/widgets.js" charset="utf-8">
</script>

<!-- It's a javascript file which will perform 
all actions which we need to show tweets-->

Step 4: Add the above code to your HTML file in which you want to show tweets and add some CSS to make it looks more beautiful and convenient.

Example: In this example, we will apply the above steps.

HTML




<!DOCTYPE html>
<html>
<head>
    <title>Tweets</title>
</head>
<body>
    <a class="twitter-timeline"
        <!-- In your code value of href tag will be changed -->
        Tweets by Geeksforgeeks
    </a>
 
    <script async
            src="https://platform.twitter.com/widgets.js"
            charset="utf-8">
    </script>
    <!-- It's a javascript file which will perform all
          actions which we need to show tweets-->
</body>
</html>


Output:

Output



Last Updated : 17 May, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads