Twitter Timeline Not Working - JavaScript Function Not Getting Parameters


#1

Hello,

I am attempting to add a Twitter timeline to http://coteaubooks.com/ however, all I get is a link and the text “Tweets by @CoteauBooks”.

I did some online research and did the following in an attempt to fix the issue:

I added two domains to this: www.coteaubooks.com, coteaubooks.com

I then added an http: in front of the “//platform.twitter.com/widgets.js” because I was told it would work (although it’s still valid without it).

I tried remaking the code and swapping it out with the new code as well. My code currently looks like this:

Tweets by @CoteauBooks

I then turned to Chrome’s JavaScript console and got this error: “Uncaught SyntaxError: Unexpected token (”. I traced this error right back to the line where my timeline should be generating, but isn’t. The reason it isn’t, according to my source code, is because only the following is being printed on my page:

Tweets by @CoteauBooks

Looking at this from a developers point of view, I see that this is happening because the function’s parameters are not being met. My question is why not, and how can I fix this. And if this is not the problem, then what is?

Thank you.


#2

Hi,

So from the code you’ve included there is looks like the website tool or CMS you’re using is stripping out the JavaScript code; in fact since its stripping what’s between the { … } part, I’d bet it’s misinterpreting it as a template tag.

The best fix is to find a way to include the script part of the timeline code without it being processed by your template system. Alternatively, try this:

That might work around your template problem, however note that it will only load asynchronously in more modern browsers, which could have a page performance impact for some users if our servers ever had a problem. At the least though, might help you debug the issue.

Ben


#3