<?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>Seán Hayes &#187; JavaScript</title>
	<atom:link href="http://seanhayes.name/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://seanhayes.name</link>
	<description>Web Developer in Rochester, NY (Django, JavaScript, LAMP)</description>
	<lastBuildDate>Fri, 06 Jan 2012 00:45:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Twitter Web Intents Javascript Events Not Firing</title>
		<link>http://seanhayes.name/2011/08/31/twitter-web-intents-javascript/</link>
		<comments>http://seanhayes.name/2011/08/31/twitter-web-intents-javascript/#comments</comments>
		<pubDate>Wed, 31 Aug 2011 20:33:35 +0000</pubDate>
		<dc:creator>Seán Hayes</dc:creator>
				<category><![CDATA[Web Design & Development]]></category>
		<category><![CDATA[events]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[iframe]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[web intents]]></category>

		<guid isPermaLink="false">http://seanhayes.name/?p=265</guid>
		<description><![CDATA[If you&#8217;re trying out Twitter&#8217;s Web Intents Javascript Events and it&#8217;s not working, be aware that they only work if your HTML page is loaded from an HTTP server. If you open your page locally off your hard drive it &#8230; <a href="http://seanhayes.name/2011/08/31/twitter-web-intents-javascript/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re trying out Twitter&#8217;s <a href="https://dev.twitter.com/docs/intents/events">Web Intents Javascript Events</a> and it&#8217;s not working, be aware that they only work if your HTML page is loaded from an HTTP server. If you open your page locally off your hard drive it won&#8217;t work, though you can fire up an Apache instance on your localhost and it&#8217;ll work from there.</p>
<p>Source: <a href="https://dev.twitter.com/comment/reply/304/491">https://dev.twitter.com/comment/reply/304/491</a></p>
<p>Update: It looks like this can also happen with the Facebook JavaScript API: <a href="http://forum.developers.facebook.net/viewtopic.php?pid=362167#p362167">http://forum.developers.facebook.net/viewtopic.php?pid=362167#p362167</a>. I guess <a href="http://vimeo.com/forums/topic:28340">it&#8217;s because they use iFrames</a>, and using them locally can cause security problems.</p>
]]></content:encoded>
			<wfw:commentRss>http://seanhayes.name/2011/08/31/twitter-web-intents-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Saved Web Pages from Firefox Have Scripts Removed</title>
		<link>http://seanhayes.name/2011/08/26/saved-web-pages-firefox-scripts/</link>
		<comments>http://seanhayes.name/2011/08/26/saved-web-pages-firefox-scripts/#comments</comments>
		<pubDate>Fri, 26 Aug 2011 21:39:53 +0000</pubDate>
		<dc:creator>Seán Hayes</dc:creator>
				<category><![CDATA[Web Design & Development]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[maf]]></category>
		<category><![CDATA[missing]]></category>

		<guid isPermaLink="false">http://seanhayes.name/?p=262</guid>
		<description><![CDATA[So, I was just in the middle of a programming test for a job application where I had to download an HTML page, edit the JavaScript to perform a desired task, and email it back. I downloaded the page, but &#8230; <a href="http://seanhayes.name/2011/08/26/saved-web-pages-firefox-scripts/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So, I was just in the middle of a programming test for a job application where I had to download an HTML page, edit the JavaScript to perform a desired task, and email it back. I downloaded the page, but the JavaScript had been replaced by the text, &#8220;Script removed by snapshot save&#8221;. Luckily the removed JS was only one line and I was able to figure out what it was.</p>
<p>Afterwards, I went searching for the cause and found <a href="http://forums.informaction.com/viewtopic.php?f=10&#038;t=5641#p25574" title="InformAction Forums &bull; View topic - Script removed by snapshot save">this forum post</a>, which explains that the problem is caused by the Mozilla Archive Format extension, which has a setting that even affects pages not saved as .maff. To fix the problem, go into the MAF extension settings and change &#8220;When saving complete web page contents:&#8221; from &#8220;Take a faithful snapshot of the page&#8221; to one of the other options.</p>
]]></content:encoded>
			<wfw:commentRss>http://seanhayes.name/2011/08/26/saved-web-pages-firefox-scripts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Advice from my Experience with OAuth</title>
		<link>http://seanhayes.name/2010/07/02/advice-experience-oauth/</link>
		<comments>http://seanhayes.name/2010/07/02/advice-experience-oauth/#comments</comments>
		<pubDate>Sat, 03 Jul 2010 01:57:44 +0000</pubDate>
		<dc:creator>Seán Hayes</dc:creator>
				<category><![CDATA[Web Design & Development]]></category>
		<category><![CDATA[advice]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[Darkroom]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[oauth]]></category>
		<category><![CDATA[picasa]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://seanhayes.name/?p=191</guid>
		<description><![CDATA[I recently finished coding the OAuth authentication method for accessing Picasa photos from within Darkroom. Since it was written client side using JavaScript I was trying to be as minimalist as possible, so I wrote my own minimal implementation rather &#8230; <a href="http://seanhayes.name/2010/07/02/advice-experience-oauth/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I recently finished coding the <a href="http://oauth.net/">OAuth</a> authentication method for accessing <a href="http://picasaweb.google.com/">Picasa</a> photos from within <a href="http://mugtug.com/darkroom/">Darkroom</a>. Since it was written client side using JavaScript I was trying to be as minimalist as possible, so I wrote my own minimal implementation rather than using a library. I&#8217;m sure most developers using OAuth use a library, which is probably why it&#8217;s hard to find advice on writing your own implementation, so I thought I&#8217;d share some tips, FAQ style.</p>
<p><strong>Use the right documentation.</strong><br />
There&#8217;s a lot of outdated docs out there. I frequently find myself at <a href="http://oauth.net/core/1.0a/">OAuth Core 1.0 Revision A</a>, and it&#8217;s such a pretty page and easy on the eyes, but way at the top where you&#8217;re likely to miss it is a notice saying it&#8217;s obsolete. The notice says to use <a href="http://tools.ietf.org/html/rfc5849">RFC 5849: The OAuth 1.0 Protocol</a> and, although hideous, it&#8217;s up to date and more complete.</p>
<p><strong>How&#8217;s the signature algorithm written?</strong><br />
Here&#8217;s some pseudo-code:<br />
<script type="text/javascript" src="http://gist.github.com/462169.js?file=signRequest.pseudo_code"></script></p>
<p>If you&#8217;re writing in JavaScript as well I recommend <a href="http://code.google.com/p/crypto-js/">Crypto-JS</a>.</p>
<p><strong>What&#8217;s the format for the timestamp?</strong><br />
It&#8217;s just a UNIX timestamp (in seconds).</p>
<p><strong>How do I generate a nonce value?</strong><br />
The OAuth spec just says it&#8217;s a random string. I think the Google documentation says something about using a string representation of a 64 bit integer. I had no idea what they were talking about, but somewhere I read you just need to md5 hash a random integer, and it worked for me.</p>
<p><strong>If developing for a Google service, use their OAuth playground.</strong><br />
Their <a href="http://googlecodesamples.com/oauth_playground/">OAuth Playground</a> is a great way to see the process you have to go through and what the requests look like. If trying to authenticate with another provider see if they also have an API test app.</p>
<p><strong>Don&#8217;t expect detailed errors.</strong><br />
You&#8217;ll be lucky if the response tells you &#8220;signature invalid&#8221;, but you won&#8217;t be told what&#8217;s wrong with it. My strategy was to compare my signatures and parameters to those used by the Google Playground; taking values from there that you know are valid and using them to test your code is a good way to debug.</p>
<p><strong>The scope parameter has to EXACTLY match the URLs used in your API calls</strong><br />
In the Google OAuth Playground, selecting &#8220;Picasa Web&#8221; will input &#8220;https://picasaweb.google.com/data/&#8221; for the scope. Note the use of https:// for the protocol. If you make API calls using that URL, it will fail since none of the Picasa services are served over https. If you try to make calls using regular http you will get an OAuth error saying invalid scope. In order for it all to work, you have to use &#8220;http://picasaweb.google.com/data/&#8221; for the scope.</p>
]]></content:encoded>
			<wfw:commentRss>http://seanhayes.name/2010/07/02/advice-experience-oauth/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MugTug Darkroom, Online/Offline Photo Editing</title>
		<link>http://seanhayes.name/2010/05/20/darkroom-online-offline-photo-editing/</link>
		<comments>http://seanhayes.name/2010/05/20/darkroom-online-offline-photo-editing/#comments</comments>
		<pubDate>Thu, 20 May 2010 17:07:28 +0000</pubDate>
		<dc:creator>Seán Hayes</dc:creator>
				<category><![CDATA[About]]></category>
		<category><![CDATA[Web Design & Development]]></category>
		<category><![CDATA[application cache]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[Darkroom]]></category>
		<category><![CDATA[Google I/O]]></category>
		<category><![CDATA[HTML 5]]></category>
		<category><![CDATA[image editing]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[local storage]]></category>
		<category><![CDATA[MugTug]]></category>
		<category><![CDATA[online]]></category>

		<guid isPermaLink="false">http://seanhayes.name/?p=153</guid>
		<description><![CDATA[For those of you who don&#8217;t know, a few weeks ago I joined a project called Darkroom from MugTug.com. It&#8217;s an image processing application using cutting edge HTML 5 features such as the &#60;canvas&#62; element, localStorage, and application cache, and &#8230; <a href="http://seanhayes.name/2010/05/20/darkroom-online-offline-photo-editing/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>For those of you who don&#8217;t know, a few weeks ago I joined a project called <a href="http://mugtug.com/darkroom/">Darkroom</a> from <a href="http://mugtug.com/">MugTug.com</a>. It&#8217;s an image processing application using cutting edge HTML 5 features such as <a href="https://developer.mozilla.org/en/HTML/Canvas">the &lt;canvas&gt; element</a>, <a href="https://developer.mozilla.org/en/DOM/Storage">localStorage</a>, and <a href="https://developer.mozilla.org/en/offline_resources_in_firefox">application cache</a>, and all the editing (and most of the GUI) is done client side using JavaScript, so it works even without an Internet connection.</p>
<p>Yesterday it was demoed during the <a href="http://code.google.com/events/io/2010/">Google I/O 2010</a> Keynote Speech:<br />
<object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/4MrEtsplano&#038;hl=en_US&#038;fs=1&#038;color1=0x3a3a3a&#038;color2=0x999999&#038;hd=1&#038;start=110&#038;end=300"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/4MrEtsplano&#038;hl=en_US&#038;fs=1&#038;color1=0x3a3a3a&#038;color2=0x999999&#038;hd=1&#038;start=110&#038;end=300"" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object></p>
<p>There&#8217;s currently a <a href="http://mugtug.com/darkroom/">development version</a> live, feel free to visit the site and try it out!</p>
]]></content:encoded>
			<wfw:commentRss>http://seanhayes.name/2010/05/20/darkroom-online-offline-photo-editing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

