Timeline Embed Shows Nothing

widgetsjs

#1

I am trying to create my own site where I would like to display my Twitter timeline on a page. I have followed the instructions (Go to my account>Settings>Widgets>Create New Widget which takes me to publish.twitter.com where I enter my account (@Rex_Critchlow) and select the format I want. It then says “That’s all we need” and gives me the code to paste into my web page, followed by an example of what the result should look like.

Because of the difficulties I have had getting this to work, I created a new, blank HTML document in Dreamweaver and pasted in the code from twitter. It looks like this:

<a 
  class="twitter-timeline"
  href="https://twitter.com/Rex_Critchlow">
  Tweets by Rex_Critchlow
</a>
<script 
  async
  src="//platform.twitter.com/widgets.js" charset="utf-8">
</script>

I save the page and view it in any of my browsers (Firefox, Opera, Chrome or IE) and I get only “Tweets by @Rex_Critchlow” which is a link to my Twitter account.

I found a bunch of code in another discussion that displays someone’s timeline, but if I try to change it to mine I get only the word “Tweets”. That code is as follows:

<a class="twitter-timeline" href="https://twitter.com/SamenSlimZorgen" data-widget-id="663659067018223616">Tweets</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>

I assumed the long number was the User ID. When I replace it with mine, it dies.

Any ideas?


#2

A link appearing without a rendered widget is likely a result of Twitter’s widgets JavaScript not loading on your page. View source of the output page and search for platform.twitter.com/widgets.js to confirm your pasted code appears on the frontend.


#3

As much as I appreciate your input, for the layman it was, unfortunately, useless. However, I have managed to fix the problem (only took two days). For others experiencing this issue, you need to add the following script to the Head section of your page…

  <script>window.twttr = (function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0],
      t = window.twttr || {};
    if (d.getElementById(id)) return t;
    js = d.createElement(s);
    js.id = id;
    js.src = "https://platform.twitter.com/widgets.js";
    fjs.parentNode.insertBefore(js, fjs);

    t._e = [];
    t.ready = function(f) {
      t._e.push(f);
    };
      return t;
    }(document, "script", "twitter-wjs"));
  </script>

Hope this saves someone some time. :slight_smile:


#4

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