Alamin
Alamin

Reputation: 887

How to embed twitter timeline widget in HTML

I am trying to show twitter timeline of my website. I have created a widget from https://twitter.com/settings/widgets . twitter give me a code to embed my html file. This is the code

  <a class="twitter-timeline" href="https://twitter.com/alamin0611" data-widget-id="598420614932779008">Tweets by @alamin0611</a> 
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s) [0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> 

But it is only showing Tweets by @alamin0611 . I have search a lot but no luck. Please tell me the solution.

Upvotes: 1

Views: 18011

Answers (2)

antelove
antelove

Reputation: 3348

<a class="twitter-timeline" data-width="300" data-height="400" href="https://twitter.com/TwitterDev">Tweets by TwitterDev</a> 

<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>

my first answer in forum :)

Upvotes: 0

th0ward
th0ward

Reputation: 285

In the script tags have you changed this url platform.twitter.com/widgets.js if I remove https:// it works as expected.

Like so:

<a class="twitter-timeline" href="https://twitter.com/alamin0611" data-widget-id="598420614932779008">Tweets by @alamin0611</a> 
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s) [0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> 

Upvotes: 1

Related Questions