twitter widget coding

  • 1
  • Question
  • Updated 6 years ago
  • Answered
i am trying to add my twitter widget into my site and i insert the http code and it states that there is a error with my pasted javascript code. i got the code from twitter its self? anyone have this problem too?
Photo of brooks

brooks

  • 12 Posts
  • 0 Reply Likes

Posted 9 years ago

  • 1
Photo of Emmy

Emmy

  • 5892 Posts
  • 299 Reply Likes
Hello Brooks,

Are you adding the code to an HTML Widget? If you got the code from Twitter, I am not sure why you are getting an error. Are you able to paste the code here so that I can test it. If you do, just put <!-- at the beginning and --> at the end; that will make it so that I can see it on the page.

Kind Regards,
Emmy
Photo of brooks

brooks

  • 12 Posts
  • 0 Reply Likes
Photo of brooks

brooks

  • 12 Posts
  • 0 Reply Likes
<!--<script src="http://widgets.twimg.com/j/2/widget.j...>
<script>
new TWTR.Widget({
version: 2,
type: 'profile',
rpp: 4,
interval: 6000,
width: 250,
height: 300,
theme: {
shell: {
background: '#807d80',
color: '#ffffff'
},
tweets: {
background: '#0b295c',
color: '#ffffff',
links: '#4aed05'
}
},
features: {
scrollbar: false,
loop: false,
live: false,
hashtags: true,
timestamp: true,
avatars: false,
behavior: 'all'
}
}).render().setUser('theappleishop').start();
</script>-->
Photo of Donald

Donald

  • 2991 Posts
  • 37 Reply Likes
yea, same things happens with getclicky for me... but my getclicky still works properly. If the widget appears to work fine I would just ignore the warning.
Photo of brooks

brooks

  • 12 Posts
  • 0 Reply Likes
problem is it wont add the the twitter on my page
Photo of Sanja

Sanja, Official Rep

  • 10698 Posts
  • 495 Reply Likes
Brooks - if it's not adding a twitter widget to your page, then there might be something amiss with your code. When you do add your twitter code, save it and then try previewing it. Do you see it come up then on the page?
Photo of Emmy

Emmy

  • 5892 Posts
  • 299 Reply Likes
Hi Brooks,
I tested your code on a test site and it works well for me, here is a screen shot of how it looks:


Can you try the code again by dragging an HTML widget onto the page and pasting in the code. Let me know how this goes for you.

Emmy
Photo of brooks

brooks

  • 12 Posts
  • 0 Reply Likes
still no go. still gives me the same error message.....mabey i am doing something wrong? i am trying to add the widget to my site. i insert the html into the side bar and past the code into the html editor then i get the error when i select ok.
Photo of Donald

Donald

  • 2991 Posts
  • 37 Reply Likes
I understand that it says there's an error with your pasted javascript code, but does it actually interfere with your widget? Like I said, I get the exact same error message everytime I paste my getclicky code but it still works just fine.
Photo of Sanja

Sanja, Official Rep

  • 10698 Posts
  • 495 Reply Likes
Hello Brooks

Are you perhaps getting a message that is similar to this:
"Oops! An error has occurred with your pasted javascript code. Please check your code"?

If you are, I can certainly understand how disconcerting it must be to receive this error message. The twitter code may have caused a JavaScript error on Drop. Here is a way to work around it:

Click the "OK" button in the error dialog, save your page, navigate to another page or create a new page, then navigate back to the page where you've embedded the Twitter widget and you should hopefully no longer get the error.

PLEASE NOTE: If you clear your cache, this error may reappear. It should not cause any trouble with your Twitter functioning properly.

Please let me know if you feel that this does not answer your question.
Photo of Donald

Donald

  • 2991 Posts
  • 37 Reply Likes
that's what I was trying to say! lol
Photo of brooks

brooks

  • 12 Posts
  • 0 Reply Likes
still no go did everything exactly the way you explained and still no go. i even tried it on every page and still get the message. don't know whats going on if the coding is correct but still get a error message
Photo of Sanja

Sanja, Official Rep

  • 10698 Posts
  • 495 Reply Likes
Brooks.. if you'd like, you can send an email to support@yola.com. We can take a closer look at what's going on.
Photo of UK Duke

UK Duke, Champion

  • 3321 Posts
  • 213 Reply Likes
If you were trying to add it to a blog post it probably wouldnt work. Just thought i'd mention it as i can not see exatly where your trying to post the code.

Lee.
Photo of Donald

Donald

  • 2991 Posts
  • 37 Reply Likes
What exactly is wrong with it besides that message? Is something missing in the widget? Is there incorrect information?
Photo of brooks

brooks

  • 12 Posts
  • 0 Reply Likes
no reply from tech support. tried it again today and still the same result. any other suggestions
Photo of Donald

Donald

  • 2991 Posts
  • 37 Reply Likes
may I ask what's wrong with the code? Does the widget look deformed? Is it not functioning properly? Is it not showing up at all?
Photo of Sanja

Sanja, Official Rep

  • 10698 Posts
  • 495 Reply Likes
Hello Brooks

The Yola Support Team will respond to support requests in under 24 hours, but usually much quicker than that. Is it possible that our emails to you are going into your Spam/Junk mail folder or that you are using a different email inbox? I have looked back at the history of your support requests and see that Kershnee was the last person to respond to you on November 14, 2009. Can you confirm that you have received this?
Photo of brooks

brooks

  • 12 Posts
  • 0 Reply Likes
i apologize their email was in my spam folder.
Photo of Sanja

Sanja, Official Rep

  • 10698 Posts
  • 495 Reply Likes
I'm glad to hear that you were able to find the email. :) Please put us on your safe list so that you can be sure to get our emails in the future.
Photo of crowvalen

crowvalen

  • 2 Posts
  • 0 Reply Likes
I am having this exact same problem, and the explanation/workaround above does not fix the issue.
I paste the twitter widget code into the HTML widget, i get the above error message. When i click okay, it removes the HTML Widget from the page that I added it to and the code is missing, as if no changes were made.
Photo of crowvalen

crowvalen

  • 2 Posts
  • 0 Reply Likes
sorry, nevermind. there is definitely some bug here. I got an error message 4 times in a row and it wasn't working. I tried it a fifth time and it worked fine.
Photo of Emmy

Emmy

  • 5892 Posts
  • 299 Reply Likes
Hello crowvalen,
I'm sorry that was difficult to get added to your page. Would you be able to paste your code here with <!-- at the beginning and --> at the end so I can test it. I'd like to see how it behaves for me and if the error message is given. Thanks.
Photo of Eric Wiener

Eric Wiener

  • 2 Posts
  • 0 Reply Likes
Hard to believe this was posted 3 years ago, and not addressed.
Error is with the Twitter code. It is easily reproduced.
Put the twitter code (which normally generates a Follow button) inside a form tag.
------------------------------------------------------------
Here is the reported JS Error (from firefox)
Timestamp: 7/18/12 1:58:01 PM
Error: a.toLowerCase is not a function
Source File: http://platform.twitter.com/widgets.js
Line: 7
------------------------------------------------------------
Notice the button fails to generate.

My only solution so far is to generate the button outside the form and (on window.load ) use jquery to move it to the place i want it inside the form.
Works, but why do i have to do this?
Eric
Photo of Eric Wiener

Eric Wiener

  • 2 Posts
  • 0 Reply Likes
(here is where to get that code) https://twitter.com/about/resources/b...
Photo of the_pete

the_pete

  • 65 Posts
  • 16 Reply Likes
Hey Eric

I'm one of the UI engineers working on the SiteBuilder.

The JavaScript error is occurring because when the script tries to execute the toLowerCase method of the object 'a' it can't because 'a' is not a string and therefore doesn't have that method - which raises an error.

It's a bit hard for me to tell exactly what they're doing at the time because this code has been obfuscated and they're using some pretty non-standard assignment techniques (in my opinion). It would be possible to prevent this error from happening (Twitter would have to do this) by checking the type of 'a' before performing actions on it which assume that it is a string.

Is this the code you pasted?

<a href="https://twitter.com/share" class="twitter-share-button">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>


I just tested in it Firefox on OSX by adding it to an HTML widget and it seemed to work fine.

What browser are you using?

Cheers
/Pete