<?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; firefox</title>
	<atom:link href="http://dev.enekoalonso.com/tag/firefox/feed/" rel="self" type="application/rss+xml" />
	<link>http://dev.enekoalonso.com</link>
	<description>having fun with code</description>
	<lastBuildDate>Sat, 31 Jul 2010 05:51:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<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> (1)</li><li>June 8, 2010 -- <a href="http://dev.enekoalonso.com/2010/06/08/change-in-websockets-handshake-protocol/" title="Change in WebSockets handshake protocol">Change in WebSockets handshake protocol</a> (0)</li><li>April 28, 2010 -- <a href="http://dev.enekoalonso.com/2010/04/28/mooml-1-2-3-bye-bye-with/" title="Mooml 1.2.3 &#8211; Bye, bye, with()">Mooml 1.2.3 &#8211; Bye, bye, with()</a> (0)</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>
		<item>
		<title>Debugging cookies with Firebug 1.5/1.6</title>
		<link>http://dev.enekoalonso.com/2010/01/20/debugging-cookies-with-firebug-1-51-6/</link>
		<comments>http://dev.enekoalonso.com/2010/01/20/debugging-cookies-with-firebug-1-51-6/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 04:43:09 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[breakpoint]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[firebug]]></category>
		<category><![CDATA[firecookie]]></category>
		<category><![CDATA[firefox]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=412</guid>
		<description><![CDATA[I&#8217;ve been using Firebug 1.5 since it was an alpha and now I&#8217;m using Firebug 1.6 alpha with Firefox 3.6. I&#8217;ve been also using Firecookie for a very long time now, but never realized about this: you can put breakpoints on cookies to detect changes! Good to know :) Related Posts:January 19, 2010 -- Firefox [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using Firebug 1.5 since it was an alpha and now I&#8217;m using <a href="http://getfirebug.com/releases/firebug/1.6X/">Firebug 1.6</a> alpha with Firefox 3.6. I&#8217;ve been also using <a href="https://addons.mozilla.org/en-US/firefox/addon/6683">Firecookie</a> for a very long time now, but never realized about this: <a href="http://www.softwareishard.com/blog/firebug/new-firebug-15-debugging-cookies/">you can put breakpoints on cookies to detect changes!</a></p>
<p>Good to know :)</p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><li>January 19, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/19/firefox-3-6rc2-firebug-1-6a/" title="Firefox 3.6RC2 &#038; Firebug 1.6a">Firefox 3.6RC2 &#038; Firebug 1.6a</a> (0)</li><li>November 30, 2008 -- <a href="http://dev.enekoalonso.com/2008/11/30/injecting-javascript-with-firebug/" title="Injecting javascript with Firebug">Injecting javascript with Firebug</a> (0)</li><li>May 14, 2010 -- <a href="http://dev.enekoalonso.com/2010/05/14/interesting-json-vulnerability-old-stuff/" title="Interesting JSON vulnerability (old stuff)">Interesting JSON vulnerability (old stuff)</a> (0)</li><li>January 27, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/27/detecting-when-css-gets-loaded-by-the-browser-with-mootools-and-asset-css/" title="Detecting when CSS gets loaded by the browser with Mootools and Asset.css">Detecting when CSS gets loaded by the browser with Mootools and Asset.css</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2010/01/20/debugging-cookies-with-firebug-1-51-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Firefox 3.6RC2 &amp; Firebug 1.6a</title>
		<link>http://dev.enekoalonso.com/2010/01/19/firefox-3-6rc2-firebug-1-6a/</link>
		<comments>http://dev.enekoalonso.com/2010/01/19/firefox-3-6rc2-firebug-1-6a/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 15:52:50 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[firebug]]></category>
		<category><![CDATA[firefox]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=410</guid>
		<description><![CDATA[I love Firefox for web development. I have tried other browsers but nothing compares to the power of Firebug. For everything else I used to use Safari 4, but now I switched to Chrome. It is sooo fast. Either way, don&#8217;t miss Firefox 3.6RC2 with Firebug 1.6a! http://www.mozilla.com/en-US/firefox/3.6rc2/releasenotes/ http://getfirebug.com/releases/firebug/1.6X/ Related Posts:January 20, 2010 -- Debugging [...]]]></description>
			<content:encoded><![CDATA[<p>I love Firefox for web development. I have tried other browsers but nothing compares to the power of Firebug. For everything else I used to use Safari 4, but now I switched to Chrome. It is sooo fast.</p>
<p>Either way, don&#8217;t miss Firefox 3.6RC2 with Firebug 1.6a!<br />
<a href="http://www.mozilla.com/en-US/firefox/3.6rc2/releasenotes/">http://www.mozilla.com/en-US/firefox/3.6rc2/releasenotes/</a><br />
<a href="http://getfirebug.com/releases/firebug/1.6X/">http://getfirebug.com/releases/firebug/1.6X/</a></p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><li>January 20, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/20/debugging-cookies-with-firebug-1-51-6/" title="Debugging cookies with Firebug 1.5/1.6">Debugging cookies with Firebug 1.5/1.6</a> (0)</li><li>November 30, 2008 -- <a href="http://dev.enekoalonso.com/2008/11/30/injecting-javascript-with-firebug/" title="Injecting javascript with Firebug">Injecting javascript with Firebug</a> (0)</li><li>May 14, 2010 -- <a href="http://dev.enekoalonso.com/2010/05/14/interesting-json-vulnerability-old-stuff/" title="Interesting JSON vulnerability (old stuff)">Interesting JSON vulnerability (old stuff)</a> (0)</li><li>January 27, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/27/detecting-when-css-gets-loaded-by-the-browser-with-mootools-and-asset-css/" title="Detecting when CSS gets loaded by the browser with Mootools and Asset.css">Detecting when CSS gets loaded by the browser with Mootools and Asset.css</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2010/01/19/firefox-3-6rc2-firebug-1-6a/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Injecting javascript with Firebug</title>
		<link>http://dev.enekoalonso.com/2008/11/30/injecting-javascript-with-firebug/</link>
		<comments>http://dev.enekoalonso.com/2008/11/30/injecting-javascript-with-firebug/#comments</comments>
		<pubDate>Mon, 01 Dec 2008 05:29:22 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[console]]></category>
		<category><![CDATA[firebug]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[injection]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=64</guid>
		<description><![CDATA[Sometimes you may want to include a Javascript file on a live web page to see how things will work or to try new things. Usually you would do this by editing the source code including the new file but there is a fastest way if you have Firefox with Firebug. Just run the following [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes you may want to include a Javascript file on a live web page to see how things will work or to try new things. Usually you would do this by editing the source code including the new file but there is a fastest way if you have Firefox with Firebug. Just run the following code in the Javascript console:</p>
<div class="geshi no javascript">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">var</span> headID = document.<span class="me1">getElementsByTagName</span><span class="br0">&#40;</span><span class="st0">&quot;head&quot;</span><span class="br0">&#41;</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">var</span> newScript = document.<span class="me1">createElement</span><span class="br0">&#40;</span><span class="st0">&#39;script&#39;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">newScript.<span class="me1">type</span> = <span class="st0">&#39;text/javascript&#39;</span>;</div>
</li>
<li class="li1">
<div class="de1">newScript.<span class="me1">src</span> = <span class="st0">&#39;http://enekoalonso.com/lib/jquery-1.2.6.min.js&#39;</span>;</div>
</li>
<li class="li1">
<div class="de1">headID.<span class="me1">appendChild</span><span class="br0">&#40;</span>newScript<span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>Here I am loading the jQuery library from my own server, but I could load any Javascript from any server on the net. The best is this will work on any website, whenever you have access to the server or not. Once you have the Javascript loaded you can use it right away. For example, here on this blog I could use jQuery to check how the header will look if its height was only 100px by running the next command on the console:</p>
<div class="geshi no javascript">
<ol>
<li class="li1">
<div class="de1">jQuery<span class="br0">&#40;</span><span class="st0">&#39;#header&#39;</span><span class="br0">&#41;</span>.<span class="me1">css</span><span class="br0">&#40;</span><span class="st0">&#39;height&#39;</span>,<span class="nu0">100</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>Yep, it won&#8217;t look very good, right? Try it! You have to see it by yourself. Firefox is great. Firebug is awesome. And Firebug&#8217;s Javascript console is the best thing ever!<br />
PS: In case you are wondering, the Javascript file injected will exist only on the current browser session.</p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><li>December 2, 2008 -- <a href="http://dev.enekoalonso.com/2008/12/02/highlighting-elements-with-firebug-console/" title="Highlighting elements with Firebug console">Highlighting elements with Firebug console</a> (0)</li><li>January 20, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/20/debugging-cookies-with-firebug-1-51-6/" title="Debugging cookies with Firebug 1.5/1.6">Debugging cookies with Firebug 1.5/1.6</a> (0)</li><li>January 19, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/19/firefox-3-6rc2-firebug-1-6a/" title="Firefox 3.6RC2 &#038; Firebug 1.6a">Firefox 3.6RC2 &#038; Firebug 1.6a</a> (0)</li><li>May 14, 2010 -- <a href="http://dev.enekoalonso.com/2010/05/14/interesting-json-vulnerability-old-stuff/" title="Interesting JSON vulnerability (old stuff)">Interesting JSON vulnerability (old stuff)</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2008/11/30/injecting-javascript-with-firebug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
