Script tags and Meteor


#1

I’m using embedly and I want to insert the html returned into a template. Most of the time it works but if the html has a script tag then Meteor doesn’t render it and everything falls apart. Anyway around this?

I guess this is blasphemy against Meteor’s principals but I have no way to know what kind of script I need until I do the api request. I could rewrite the wntire embedly api using Meteor but let’s be real - I couldn’t.


#2

i dont know embedly but to insert plain html or plain strings into the dom use {{{ }}} instead if {{ }} but this is a very insecure way.

a second way would be to manualy create a dom element with js and set it up.
for more info look at that: https://developer.mozilla.org/de/docs/Web/API/Document/createElement


#3

Can you post an example of your code?


#4

This is the code needed to render a tweet.

<blockquote 
class="twitter-tweet"><p>We know how we’ll be watchin' <a 
href="https://twitter.com/GameOfThrones">@GameOfThrones</a> 
season 5. 👍 
<a href="https://twitter.com/AppStore">@AppStore</a> <a 
href="https://twitter.com/HBO">@HBO</a> <a 
href="https://twitter.com/hashtag/HBONOW?src=hash">#HBONOW</a> 
<a 
href="https://twitter.com/hashtag/AppleLive?src=hash">#AppleLive</a>
 <a href="http://t.co/uEVwKeP9am">http://t.co/uEVwKeP9am</a>
<a 
href="https://t.co/d071Y5Cglx">https://t.co/d071Y5Cglx</a></p>—
 iTunes TV (@iTunesTV) <a 
href="https://twitter.com/iTunesTV/status/574981199099076608">March 
9, 2015</a></blockquote>
<script async src="//platform.twitter.com/widgets.js" 
charset="utf-8"></script>

#5

Any news on this one @fardeemmunir ? I have the same problem it’s annoying ;(.


#6

FYI I’ve fallback on jquery script loading http://stackoverflow.com/questions/3857874/how-to-dynamically-insert-a-script-tag-via-jquery-after-page-load if the embed api presents a script to load i extract the source out of it.