I'm using labjs to load my scripts. I've got a script from feedburner which shows the lastest posts from my blog in HTML from my rss feed. The code from feedburner is and works just fine, showing all the posts in html:
<script src="http://feeds.feedburner.com/Goonerhood?format=sigpro" type="text/javascript" ></script>
I'm trying to load the same script using labjs, but it's not showing anything. Here's my code:
<script>
$LAB
.script("http://feeds.feedburner.com/Goonerhood?format=sigpro");
</script>
Any suggestion where I'm going wrong?
The problem is that that script is all about
document.write
, which cannot be used (well, should not be used) when you're loading a script with any sort of dynamic, asynchronous technique.The
document.write
function can be used when a script is imported with a<script>
tag for two reasons:document.write
appends content to the in-progress DOM.When you load a script asynchronously, the script won't be executed until after the DOM is completed. At that point, a call to
document.write
implicitly callsdocument.open
, which on an already-built page will blow everything away.