<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>dev.enekoalonso.com &#187; chrome</title>
	<atom:link href="http://dev.enekoalonso.com/tag/chrome/feed/" rel="self" type="application/rss+xml" />
	<link>http://dev.enekoalonso.com</link>
	<description>having fun with code</description>
	<lastBuildDate>Wed, 12 Oct 2011 21:40:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Change in WebSockets handshake protocol</title>
		<link>http://dev.enekoalonso.com/2010/06/08/change-in-websockets-handshake-protocol/</link>
		<comments>http://dev.enekoalonso.com/2010/06/08/change-in-websockets-handshake-protocol/#comments</comments>
		<pubDate>Tue, 08 Jun 2010 16:12:07 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[change]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[devchannel]]></category>
		<category><![CDATA[handshake]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[websockets]]></category>
		<category><![CDATA[websoket]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=587</guid>
		<description><![CDATA[If you are working with the latest version of Google Chrome (6.0.442.0) and you have been doing some testing or projects with WebSockets you may have already noticed there has been a change in the WebSockets specification for the client/server handshake protocol. More info about the change: http://webreflection.blogspot.com/2010/06/websocket-handshake-76-simplified.html http://blog.chromium.org/2010/06/websocket-protocol-updated.html Related Posts:May 22, 2010 -- More [...]]]></description>
			<content:encoded><![CDATA[<p>If you are working with the latest version of Google Chrome (6.0.442.0) and you have been doing some testing or projects with WebSockets you may have already noticed there has been a change in the WebSockets specification for the client/server handshake protocol.</p>
<p>More info about the change:<br />
<a href="http://webreflection.blogspot.com/2010/06/websocket-handshake-76-simplified.html">http://webreflection.blogspot.com/2010/06/websocket-handshake-76-simplified.html</a><br />
<a href="http://blog.chromium.org/2010/06/websocket-protocol-updated.html">http://blog.chromium.org/2010/06/websocket-protocol-updated.html</a></p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><li>May 22, 2010 -- <a href="http://dev.enekoalonso.com/2010/05/22/more-websockets-now-with-python/" title="More WebSockets, now with Python!">More WebSockets, now with Python!</a> (9)</li><li>May 3, 2010 -- <a href="http://dev.enekoalonso.com/2010/05/03/playing-with-websockets/" title="Playing with WebSockets">Playing with WebSockets</a> (4)</li><li>May 18, 2011 -- <a href="http://dev.enekoalonso.com/2011/05/18/location-hash-is-dead-on-html5-browsers/" title="location.hash is dead (on html5 browsers)">location.hash is dead (on html5 browsers)</a> (0)</li><li>May 12, 2011 -- <a href="http://dev.enekoalonso.com/2011/05/12/angry-birds-as-a-web-app/" title="Angry Birds as a Web App">Angry Birds as a Web App</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2010/06/08/change-in-websockets-handshake-protocol/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Detecting when CSS gets loaded by the browser with Mootools and Asset.css</title>
		<link>http://dev.enekoalonso.com/2010/01/27/detecting-when-css-gets-loaded-by-the-browser-with-mootools-and-asset-css/</link>
		<comments>http://dev.enekoalonso.com/2010/01/27/detecting-when-css-gets-loaded-by-the-browser-with-mootools-and-asset-css/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 19:20:22 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[asset]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[ie]]></category>
		<category><![CDATA[mootools]]></category>
		<category><![CDATA[mozilla]]></category>
		<category><![CDATA[opera]]></category>
		<category><![CDATA[safari]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=416</guid>
		<description><![CDATA[Asset.css claims to have an onload event in Mootools documentation, but sadly, not all browsers support this feature. Even worse, browsers like Chrome seem to support the event, but never fire it. After some research and testing at work, we have come up with a solution that overrides Asset.css to detect when CSS gets loaded [...]]]></description>
			<content:encoded><![CDATA[<p>Asset.css claims to have an <strong>onload</strong> event in <a href="http://mootools.net/docs/more/Utilities/Assets#Asset:css">Mootools documentation</a>, but sadly, not all browsers support this feature. Even worse, browsers like Chrome seem to support the event, but never fire it.</p>
<p>After some research and testing at work, we have come up with a solution that overrides Asset.css to detect when CSS gets loaded by the browser using the onload event in those browsers that support it (Internet Explorer and Opera) and doing polling in those that do not (Chrome, Safari and Firefox). Here is the code:</p>
<div class="geshi no javascript">
<ol>
<li class="li1">
<div class="de1"><span class="co1">// Add callback support to Asset.css for all browsers</span></div>
</li>
<li class="li1">
<div class="de1">Asset.<span class="me1">css</span> = <span class="kw2">function</span><span class="br0">&#40;</span>source, <span class="kw3">onLoad</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw2">var</span> link = <span class="kw2">new</span> Element<span class="br0">&#40;</span><span class="st0">&#39;link&#39;</span>, <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; rel: <span class="st0">&#39;stylesheet&#39;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; media: <span class="st0">&#39;screen&#39;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; type: <span class="st0">&#39;text/css&#39;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; href: source</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#40;</span><span class="st0">&quot;onload&quot;</span> <span class="kw1">in</span> link<span class="br0">&#41;</span> <span class="sy0">&amp;&amp;</span> <span class="sy0">!</span>Browser.<span class="me1">Engines</span>.<span class="me1">webkit</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="kw3">onLoad</span><span class="br0">&#41;</span> link.<span class="kw3">onload</span> = <span class="kw3">onLoad</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="kw1">try</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; link.<span class="me1">sheet</span>.<span class="me1">cssRules</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">catch</span> <span class="br0">&#40;</span>e<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; setTimeout<span class="br0">&#40;</span>arguments.<span class="me1">callee</span>, <span class="nu0">100</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="kw3">onLoad</span><span class="br0">&#41;</span> <span class="kw3">onLoad</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; link.<span class="me1">inject</span><span class="br0">&#40;</span>document.<span class="me1">head</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">return</span> link;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// Load some CSS and show an alert when done</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">var</span> mycss = <span class="kw2">new</span> Asset.<span class="me1">css</span><span class="br0">&#40;</span><span class="st0">&#39;http://example.com/style.css&#39;</span>, <span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw3">alert</span><span class="br0">&#40;</span><span class="st0">&#39;CSS loaded!&#39;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// Unload the css</span></div>
</li>
<li class="li1">
<div class="de1">mycss.<span class="me1">destroy</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>Enjoy!</p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><li>June 30, 2009 -- <a href="http://dev.enekoalonso.com/2009/06/30/iphone-3-0-geolocation-with-javascript/" title="iPhone 3.0 geolocation with Javascript">iPhone 3.0 geolocation with Javascript</a> (1)</li><li>March 1, 2009 -- <a href="http://dev.enekoalonso.com/2009/03/01/safari-4-rocks/" title="Safari 4 rocks">Safari 4 rocks</a> (2)</li><li>May 18, 2011 -- <a href="http://dev.enekoalonso.com/2011/05/18/location-hash-is-dead-on-html5-browsers/" title="location.hash is dead (on html5 browsers)">location.hash is dead (on html5 browsers)</a> (0)</li><li>October 5, 2010 -- <a href="http://dev.enekoalonso.com/2010/10/05/javascript-console-in-the-terminal-command-line/" title="Javascript console in the terminal (command line)">Javascript console in the terminal (command line)</a> (1)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2010/01/27/detecting-when-css-gets-loaded-by-the-browser-with-mootools-and-asset-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

