Play around with embedded widget scripts [sample Twitter]

4
Today I receive a question how to integrate Twitter into a Mendix site... you can go for a full integrated REST api ... But hey for a demo, you don’t have much time. So what to do: https://dev.twitter.com/docs/embedded-timelines The HTML and JavaScript Snipped widget is really power full to hack something like this into you Menix site. How to do it: Create an embedded widget at twitter https://twitter.com/settings/widgets Copy your generated code. (Note that it is a combined HTML en script) <a class="twitter-timeline" href="https://twitter.com/twitter" data-widget-id="505314721281486848">Tweets by @twitter</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> Add TWO snippet widgets on you page (else you widget will not startup) The first one you use the HTML code <a class="twitter-timeline" href="https://twitter.com/twitter" data-widget-id="505314721281486848">Tweets by @twitter</a> The second you use the JavaScript, and there you go! !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"); Probably many more sites have embedded widgets that can be used in the same way. If you have one, please share it here!
asked
0 answers