<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: (down)Loading JavaScript as strings</title>
	<atom:link href="http://www.stevesouders.com/blog/2009/12/07/downloading-javascript-as-strings/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.stevesouders.com/blog/2009/12/07/downloading-javascript-as-strings/</link>
	<description>Essential knowledge for making your web pages faster.</description>
	<lastBuildDate>Fri, 30 Jul 2010 02:13:27 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: steveg</title>
		<link>http://www.stevesouders.com/blog/2009/12/07/downloading-javascript-as-strings/comment-page-1/#comment-1304</link>
		<dc:creator>steveg</dc:creator>
		<pubDate>Mon, 04 Jan 2010 14:05:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevesouders.com/blog/?p=785#comment-1304</guid>
		<description>Hmmm! Interesting. Perhaps sometimes it&#039;s just better to hit the server instead?</description>
		<content:encoded><![CDATA[<p>Hmmm! Interesting. Perhaps sometimes it&#8217;s just better to hit the server instead?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stoimen</title>
		<link>http://www.stevesouders.com/blog/2009/12/07/downloading-javascript-as-strings/comment-page-1/#comment-1248</link>
		<dc:creator>stoimen</dc:creator>
		<pubDate>Tue, 15 Dec 2009 14:10:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevesouders.com/blog/?p=785#comment-1248</guid>
		<description>Great! It&#039;s strange how new techniques on loading javascript emerge almost every single day!!!</description>
		<content:encoded><![CDATA[<p>Great! It&#8217;s strange how new techniques on loading javascript emerge almost every single day!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kyle Simpson</title>
		<link>http://www.stevesouders.com/blog/2009/12/07/downloading-javascript-as-strings/comment-page-1/#comment-1244</link>
		<dc:creator>Kyle Simpson</dc:creator>
		<pubDate>Tue, 15 Dec 2009 03:28:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevesouders.com/blog/?p=785#comment-1244</guid>
		<description>@V1 true, some browsers will fetch a resource with the fake mimetype into cache (IE, Safari, Chrome), while others won&#039;t fetch (FF, Opera). So the caching with external resources wouldn&#039;t be reliable cross browser. But that doesn&#039;t mean you couldn&#039;t use it for the browsers that do support it. LABjs does exactly this, in fact (and uses other methods for FF/Opera).

But, moreover, not all use-cases call for the importance of loading external resources and caching. For instance, the comment-trick, AFAIK, was pioneered by google for their mobile gmail product. For them, the key was not caching or external resources, but simply deferring parsing/execution.

So, in that spirit, this trick will accomplish that use case. I think it&#039;s something valid to explore for mobile web apps, and may have some limited use cases for regular web apps too.</description>
		<content:encoded><![CDATA[<p>@V1 true, some browsers will fetch a resource with the fake mimetype into cache (IE, Safari, Chrome), while others won&#8217;t fetch (FF, Opera). So the caching with external resources wouldn&#8217;t be reliable cross browser. But that doesn&#8217;t mean you couldn&#8217;t use it for the browsers that do support it. LABjs does exactly this, in fact (and uses other methods for FF/Opera).</p>
<p>But, moreover, not all use-cases call for the importance of loading external resources and caching. For instance, the comment-trick, AFAIK, was pioneered by google for their mobile gmail product. For them, the key was not caching or external resources, but simply deferring parsing/execution.</p>
<p>So, in that spirit, this trick will accomplish that use case. I think it&#8217;s something valid to explore for mobile web apps, and may have some limited use cases for regular web apps too.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: V1</title>
		<link>http://www.stevesouders.com/blog/2009/12/07/downloading-javascript-as-strings/comment-page-1/#comment-1242</link>
		<dc:creator>V1</dc:creator>
		<pubDate>Mon, 14 Dec 2009 20:22:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevesouders.com/blog/?p=785#comment-1242</guid>
		<description>@kyle the downside of that would be that you could not cache it like you could with external files.</description>
		<content:encoded><![CDATA[<p>@kyle the downside of that would be that you could not cache it like you could with external files.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kyle Simpson</title>
		<link>http://www.stevesouders.com/blog/2009/12/07/downloading-javascript-as-strings/comment-page-1/#comment-1239</link>
		<dc:creator>Kyle Simpson</dc:creator>
		<pubDate>Fri, 11 Dec 2009 10:32:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevesouders.com/blog/?p=785#comment-1239</guid>
		<description>I wonder what the performance profile is for including the code in an inline script tag, but setting the script tag&#039;s &quot;type&quot; attribute to something other than &quot;text/javascript&quot;... like &quot;script/cache&quot; for instance. 

This is a takeoff of John Resig&#039;s micro-templating, where he includes an html template in the fake-type tag, but in this case, we actually include real code that we just want ignored for the time being.

In all browsers I know about and have tested, the code will not be parsed/executed in any way (ignored by the browser), but it is present in the DOM nonetheless.

So, when you want to execute it, the script element itself exists in the DOM and so you can retrieve the code by accessing the .text property of the script element, and then either eval() the code or do another script-injection.

NOTE: Not all browsers will download an external resource via src=&quot;...&quot; with the fake type (some do, some don&#039;t), so it couldn&#039;t be used by itself for caching per se. But, it might still be a valid approach for the use-case of inlining code that you can control/defer the execution,  like on a mobile site (mobile gmail, etc).</description>
		<content:encoded><![CDATA[<p>I wonder what the performance profile is for including the code in an inline script tag, but setting the script tag&#8217;s &#8220;type&#8221; attribute to something other than &#8220;text/javascript&#8221;&#8230; like &#8220;script/cache&#8221; for instance. </p>
<p>This is a takeoff of John Resig&#8217;s micro-templating, where he includes an html template in the fake-type tag, but in this case, we actually include real code that we just want ignored for the time being.</p>
<p>In all browsers I know about and have tested, the code will not be parsed/executed in any way (ignored by the browser), but it is present in the DOM nonetheless.</p>
<p>So, when you want to execute it, the script element itself exists in the DOM and so you can retrieve the code by accessing the .text property of the script element, and then either eval() the code or do another script-injection.</p>
<p>NOTE: Not all browsers will download an external resource via src=&#8221;&#8230;&#8221; with the fake type (some do, some don&#8217;t), so it couldn&#8217;t be used by itself for caching per se. But, it might still be a valid approach for the use-case of inlining code that you can control/defer the execution,  like on a mobile site (mobile gmail, etc).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Lantner</title>
		<link>http://www.stevesouders.com/blog/2009/12/07/downloading-javascript-as-strings/comment-page-1/#comment-1210</link>
		<dc:creator>David Lantner</dc:creator>
		<pubDate>Tue, 08 Dec 2009 15:31:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevesouders.com/blog/?p=785#comment-1210</guid>
		<description>... as Charles mentioned yesterday in his comment - sorry!</description>
		<content:encoded><![CDATA[<p>&#8230; as Charles mentioned yesterday in his comment &#8211; sorry!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Lantner</title>
		<link>http://www.stevesouders.com/blog/2009/12/07/downloading-javascript-as-strings/comment-page-1/#comment-1209</link>
		<dc:creator>David Lantner</dc:creator>
		<pubDate>Tue, 08 Dec 2009 15:29:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevesouders.com/blog/?p=785#comment-1209</guid>
		<description>The blog post has been updated with results for IE8.</description>
		<content:encoded><![CDATA[<p>The blog post has been updated with results for IE8.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charles Jolley</title>
		<link>http://www.stevesouders.com/blog/2009/12/07/downloading-javascript-as-strings/comment-page-1/#comment-1208</link>
		<dc:creator>Charles Jolley</dc:creator>
		<pubDate>Tue, 08 Dec 2009 00:37:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevesouders.com/blog/?p=785#comment-1208</guid>
		<description>Hi,

Thanks for the mention Steve.  I wanted to let you know that I did run the tests in IE8 today.  The results are not as good as the others.  

Basically you get no benefit from the deferred evaluation approach, though it is not significantly worse.  Statistically, given the high variability of IE, in fact, deferred evaluation is the same as regular baseline.

There might be some confounding factors here though, so I think this technique needs some more refinement in IE to really work well.  Outside of IE, it seems to have some promise however.</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>Thanks for the mention Steve.  I wanted to let you know that I did run the tests in IE8 today.  The results are not as good as the others.  </p>
<p>Basically you get no benefit from the deferred evaluation approach, though it is not significantly worse.  Statistically, given the high variability of IE, in fact, deferred evaluation is the same as regular baseline.</p>
<p>There might be some confounding factors here though, so I think this technique needs some more refinement in IE to really work well.  Outside of IE, it seems to have some promise however.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Semeria</title>
		<link>http://www.stevesouders.com/blog/2009/12/07/downloading-javascript-as-strings/comment-page-1/#comment-1207</link>
		<dc:creator>David Semeria</dc:creator>
		<pubDate>Mon, 07 Dec 2009 20:02:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevesouders.com/blog/?p=785#comment-1207</guid>
		<description>In my (still experimental) framework, I use a slightly different technique. It is based on my analysis of how long it takes a user to fully register changes to a page (approx 300ms). In this time it is possible to request and parse the additional JS which may be needed later in the application. 

Hence the app actually makes two JS requests, the first is the normal code required for the initial state, and the second is launched just after the initial state is reached.</description>
		<content:encoded><![CDATA[<p>In my (still experimental) framework, I use a slightly different technique. It is based on my analysis of how long it takes a user to fully register changes to a page (approx 300ms). In this time it is possible to request and parse the additional JS which may be needed later in the application. </p>
<p>Hence the app actually makes two JS requests, the first is the normal code required for the initial state, and the second is launched just after the initial state is reached.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: V1</title>
		<link>http://www.stevesouders.com/blog/2009/12/07/downloading-javascript-as-strings/comment-page-1/#comment-1206</link>
		<dc:creator>V1</dc:creator>
		<pubDate>Mon, 07 Dec 2009 19:46:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.stevesouders.com/blog/?p=785#comment-1206</guid>
		<description>Have you tried experimenting with different techniques to execute the javascript?

- eval
- document.createElement(&quot;script&quot;).text
- (Function(&quot;&quot;))();</description>
		<content:encoded><![CDATA[<p>Have you tried experimenting with different techniques to execute the javascript?</p>
<p>- eval<br />
- document.createElement(&#8220;script&#8221;).text<br />
- (Function(&#8220;&#8221;))();</p>
]]></content:encoded>
	</item>
</channel>
</rss>
