<?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; browser</title>
	<atom:link href="http://dev.enekoalonso.com/tag/browser/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>location.hash is dead (on html5 browsers)</title>
		<link>http://dev.enekoalonso.com/2011/05/18/location-hash-is-dead-on-html5-browsers/</link>
		<comments>http://dev.enekoalonso.com/2011/05/18/location-hash-is-dead-on-html5-browsers/#comments</comments>
		<pubDate>Wed, 18 May 2011 21:49:51 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[docs]]></category>
		<category><![CDATA[documentation]]></category>
		<category><![CDATA[hash]]></category>
		<category><![CDATA[history]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[location]]></category>
		<category><![CDATA[manipulate]]></category>
		<category><![CDATA[mdc]]></category>
		<category><![CDATA[pjax]]></category>
		<category><![CDATA[pushState]]></category>
		<category><![CDATA[url]]></category>
		<category><![CDATA[window]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=696</guid>
		<description><![CDATA[Pretty cool technique to actually change the url of the page (something until now impossible to do in Javascript for security reasons): http://badassjs.com/post/840846392/location-hash-is-dead-long-live-html5-pushstate Also good to read, the browser history MDC documentation: https://developer.mozilla.org/en/DOM/Manipulating_the_browser_history And finally, pjax, a new script that combines the use oj Ajax calls and this technique to manipulate the url to achieve [...]]]></description>
			<content:encoded><![CDATA[<p>Pretty cool technique to actually change the url of the page (something until now impossible to do in Javascript for security reasons):<br />
<a href="http://badassjs.com/post/840846392/location-hash-is-dead-long-live-html5-pushstate">http://badassjs.com/post/840846392/location-hash-is-dead-long-live-html5-pushstate</a></p>
<p>Also good to read, the browser history MDC documentation:<br />
<a href="https://developer.mozilla.org/en/DOM/Manipulating_the_browser_history">https://developer.mozilla.org/en/DOM/Manipulating_the_browser_history</a></p>
<p>And finally, pjax, a new script that combines the use oj Ajax calls and this technique to manipulate the url to achieve a beautiful ajax navigation experience, with permalinks and without the need of using location.hash.<br />
<a href="http://pjax.heroku.com/">http://pjax.heroku.com/</a></p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><li>December 29, 2008 -- <a href="http://dev.enekoalonso.com/2008/12/29/modifying-the-url-hash-without-affecting-the-browser-history/" title="Modifying the URL Hash without affecting the browser history">Modifying the URL Hash without affecting the browser history</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><li>September 17, 2010 -- <a href="http://dev.enekoalonso.com/2010/09/17/mootools-core-for-server-and-mobile-development/" title="MooTools Core for Server and Mobile Development">MooTools Core for Server and Mobile Development</a> (1)</li><li>August 27, 2010 -- <a href="http://dev.enekoalonso.com/2010/08/27/link-whirlpool-js/" title="Link: Whirlpool JS">Link: Whirlpool JS</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2011/05/18/location-hash-is-dead-on-html5-browsers/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>
		<item>
		<title>Safari 4 rocks</title>
		<link>http://dev.enekoalonso.com/2009/03/01/safari-4-rocks/</link>
		<comments>http://dev.enekoalonso.com/2009/03/01/safari-4-rocks/#comments</comments>
		<pubDate>Sun, 01 Mar 2009 15:48:20 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[safari]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=286</guid>
		<description><![CDATA[I&#8217;ve been using Safari both at home and work since last Thursday when I first knew it had been released and it looks very fast and solid. They have finally added some standard keyboard shortcuts, like Ctrl+Tab and now you can restore your previous session (all pages open) the next time you open the browser [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using Safari both at home and work since last Thursday when I first knew it had been released and it looks very fast and solid. They have finally added some standard keyboard shortcuts, like Ctrl+Tab and now you can restore your previous session (all pages open) the next time you open the browser (although not automatically like Firefox).</p>
<p>It looks very good for web development too, since it has the Javascript console integrated and you can do direct changes on the DOM and the CSS to preview how it would look. But I think Firebug is still ahead and I&#8217;m very used to it, so I&#8217;m not ready to completely stop using Firefox.</p>
<p>I have nothing against Firefox, which has been my favorite browser for years, but the fact that it is very, very slow. I&#8217;ll say today is the slowest browser out there. Or at least it looks like that sometimes. The only extension I have is Firebug. I&#8217;ve tried removing the cache, the history, etc. with no luck.</p>
<p>So yeah, so far I&#8217;m very happy with Safari 4.</p>
<p><img class="aligncenter size-medium wp-image-287" title="Safari 4" src="http://dev.enekoalonso.com/wp-content/uploads/2009/03/picture-161-417x300.png" alt="Safari 4" width="417" height="300" /></p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><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><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><li>August 3, 2010 -- <a href="http://dev.enekoalonso.com/2010/08/03/iphone-sdk-old-versions/" title="List of iPhone SDK &#038; XCode packages">List of iPhone SDK &#038; XCode packages</a> (1)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2009/03/01/safari-4-rocks/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Modifying the URL Hash without affecting the browser history</title>
		<link>http://dev.enekoalonso.com/2008/12/29/modifying-the-url-hash-without-affecting-the-browser-history/</link>
		<comments>http://dev.enekoalonso.com/2008/12/29/modifying-the-url-hash-without-affecting-the-browser-history/#comments</comments>
		<pubDate>Mon, 29 Dec 2008 23:51:15 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[hash]]></category>
		<category><![CDATA[history]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[modify]]></category>
		<category><![CDATA[replace]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=223</guid>
		<description><![CDATA[Although this is not very common, some times you would like to modify the URL hash (this is the value after the # on the URL) without affecting the browser history. Let&#8217;s say you have multiple sets of tabs on your page or simply that your hash is going to change very often. But still [...]]]></description>
			<content:encoded><![CDATA[<p>Although this is not very common, some times you would like to modify the URL hash (this is the value after the # on the URL) without affecting the browser history. Let&#8217;s say you have multiple sets of tabs on your page or simply that your hash is going to change very often. But still want the user to be able to grab a permanent link to that page configuration.</p>
<p>The trick is to use the replace function, instead of directly assigning the value.</p>
<div class="geshi no javascript">
<ol>
<li class="li1">
<div class="de1"><span class="co1">// Direct assignment will add a new step to the history on browsers like Firefox 3</span></div>
</li>
<li class="li1">
<div class="de1">window.<span class="me1">location</span>.<span class="me1">hash</span> = newHash;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// Using the replace function changes the hash without affecting the browser history.</span></div>
</li>
<li class="li1">
<div class="de1">window.<span class="me1">location</span>.<span class="me1">replace</span><span class="br0">&#40;</span>window.<span class="me1">location</span>.<span class="me1">href</span>.<span class="me1">split</span><span class="br0">&#40;</span><span class="st0">&#39;#&#39;</span><span class="br0">&#41;</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span> + <span class="st0">&#39;#&#39;</span> +newHash<span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>Nice.</p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><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>August 27, 2010 -- <a href="http://dev.enekoalonso.com/2010/08/27/link-whirlpool-js/" title="Link: Whirlpool JS">Link: Whirlpool JS</a> (0)</li><li>October 12, 2011 -- <a href="http://dev.enekoalonso.com/2011/10/12/command-line-scripting-with-node-js/" title="Command line scripting with Node.js">Command line scripting with Node.js</a> (0)</li><li>June 14, 2011 -- <a href="http://dev.enekoalonso.com/2011/06/14/titanium-studio-and-titanium-mobile-1-7/" title="Titanium Studio and Titanium Mobile 1.7">Titanium Studio and Titanium Mobile 1.7</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2008/12/29/modifying-the-url-hash-without-affecting-the-browser-history/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

