Play around with embedded widget scripts [sample Twitter]

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: 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 Copy your generated code. (Note that it is a combined HTML en script) <a class="twitter-timeline" href="" 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.src=p+"://";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="" 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.src=p+"://";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!
0 answers