Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 6    Views: 106

casz08
Apple Fan
Profile
Posts: 11
Reg: Aug 28, 2012
petersfield
2,310
02/04/13 02:28 PM (12 years ago)

Twitter widget into Custom HTML

Hello there, I am trying to itegrate this twitter widget code: <a class="twitter-timeline" data-dnt=true href="https://twitter.com/JWSPolitics" data-widget-id="298540059475447808">Tweets by @JWSPolitics</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> on to an app. However whenever I copy it into the HTML plugin it just comes up as the writing. If someone could point me in the right direction I would very much appreciate it. Cas
 
Rohan
Veteran developer
Profile
Posts: 79
Reg: Mar 12, 2011
London
10,040
like
02/04/13 03:06 PM (12 years ago)
Just had a look at your code - try putting the bit between <script and </script> into the head of the html page, and the code between <a> and </a> into the body of the page. This creates a hyperlink to the selected timeline
 
casz08
Apple Fan
Profile
Posts: 11
Reg: Aug 28, 2012
petersfield
2,310
like
02/04/13 03:17 PM (12 years ago)
Cheers for you're help Rohan really appreciate it. However could you clarify when you say into the "head" and into the "body" I'm not quite sure I follow? Apologies. Thanks again
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
02/04/13 03:21 PM (12 years ago)
When you say 'type it into the HTML Plugin' it sounds like that neat HTML5 plugin. I use that from time to time. It's sort of a 'WYSIWYG' editor, so if you're putting in java code, you'll need to make sure you press that 'Source' button; if you don't, the page will think you're typing 'text' no matter what it actually is... Cheers! -- Smug (Rohan means sorta like this:) <html> <head> <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> </head> <body> <a class="twitter-timeline" data-dnt=true href="https://twitter.com/JWSPolitics" data-widget-id="298540059475447808">Tweets by @JWSPolitics</a> </body> </html>
 
KozmoWeb
Aspiring developer
Profile
Posts: 342
Reg: Dec 08, 2012
Sarasota, FL
8,520
like
02/04/13 04:37 PM (12 years ago)
I think the new Twitter widgets require a base URL to validate the widget. For example, to show a widget here, you'd need to set the base URL as buzztouch.com in the Twitter widget setup. One way to accomodate this would be to frame the HTML from another site where the widget lives. -William
 
Rohan
Veteran developer
Profile
Posts: 79
Reg: Mar 12, 2011
London
10,040
like
02/04/13 04:39 PM (12 years ago)
Thanks smug for clarifying the code that needs to be used. Also I was wondering if anyone is aware of the usage limits placed on calling the twitter api, as outlined here... https://dev.twitter.com/docs/faq . I'm guessing that if your app does get big then Twitter will stop sending out tweet timelines to the app after a certain limit has been reached? Would you then have to cache it on your own website instead of using a direct link? Any advice would be appreciated
 
Rohan
Veteran developer
Profile
Posts: 79
Reg: Mar 12, 2011
London
10,040
like
02/04/13 04:52 PM (12 years ago)
Thanks smug for clarifying the code that needs to be used. Also I was wondering if anyone is aware of the usage limits placed on calling the twitter api, as outlined here... https://dev.twitter.com/docs/faq . I'm guessing that if your app does get big then Twitter will stop sending out tweet timelines to the app after a certain limit has been reached? Would you then have to cache it on your own website instead of using a direct link? Any advice would be appreciated
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.