<?xml version="1.0" encoding="utf-8"?>

























	
	



	
	
	

	
		
		
		

		
		
			
			
			
			
		
	
	
	
	
	
	


<rss version="2.0">	
	<channel>
		<title>Radiant Core: java tag</title>
		<link>http://www.radiantcore.com/</link>
		<description>All of the Radiant Core posts tagged with java.</description>
		<language>en-ca</language>
		<copyright>Copyright 2006, Radiant Core Inc. All rights reserved.</copyright>
		<managingEditor>webmaster@radiantcore.com</managingEditor>
		<webMaster>webmaster@radiantcore.com</webMaster>
		
			
			
			
			
			
			
			
			

			
				
			
			<item>
				<title><![CDATA[Deconstructing Facebook Beacon JavaScript]]></title>
				<author>Jay Goldman &lt;info@radiantcore.com&gt;</author>
				<link>http://www.radiantcore.com/blog/archives/23/11/2007/deconstructingfacebookbeaconjavascript</link>
				<guid isPermaLink="true">http://www.radiantcore.com/blog/archives/23/11/2007/deconstructingfacebookbeaconjavascript</guid>
				<comments>http://www.radiantcore.com/blog/archives/23/11/2007/deconstructingfacebookbeaconjavascript#comments</comments>
				<description><![CDATA[<div id="syndicatePage">Hello! If you enjoy this post, could you take a moment to stop by <a href="http://digg.com/programming/Deconstructing_Facebook_Beacon_JavaScript" title="Digg: Deconstructing Facebook Beacon JavaScript">Digg</a> and help promoted it? Thanks!</div><br /><br /> <p>On November 6th, 2007, Facebook launched a series of new tools to help advertisers target the 54 million people now regularly using their site. They're still throwing around a 3% weekly growth rate and have a target of 60 million active users by the end of the year, so it's not hard to picture the day in the not-so-distant future when hospitals Facebook babies before handing them over and the little bundle of joy comes with a neural implant that pokes their parental units when the diaper is full.</p><br /><br /><p>The new tools round out the <a href="http://www.facebook.com/business" title="Facebook Business">Facebook Business</a> offerings to an even six:</p><ul>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;<li><a href="http://www.facebook.com/business/?socialads" title="Facebook: Social Ads"><img src="http://static.ak.facebook.com/images/business_portal/socialads_48.png?12:67999" style="vertical-align: middle;" height="42" width="48"> Social Ads</a></li>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;<li><a href="http://www.facebook.com/business/?pages" title="Facebook: Pages"><img src="http://static.ak.facebook.com/images/business_portal/pages_48.png?12:67999" style="vertical-align: middle;" height="42" width="48"> Pages</a></li>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;<li><a href="http://www.facebook.com/business/?beacon" title="Facebook: Beacon"><img src="http://static.ak.facebook.com/images/business_portal/beacon_48.png?12:67999" style="vertical-align: middle;" height="42" width="48"> Beacon</a></li>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;<li><a href="http://www.facebook.com/business/?insights" title="Facebook: Insights"><img src="http://static.ak.facebook.com/images/business_portal/insights_48.png?12:67999" style="vertical-align: middle;" height="42" width="48"> Insights</a></li>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;<li><a href="http://www.facebook.com/business/?platform" title="Facebook: Platform"><img src="http://static.ak.facebook.com/images/business_portal/applications_48.png?12:68202" style="vertical-align: middle;" height="42" width="48"> Platform</a></li>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;<li><a href="http://www.facebook.com/business/?polls" title="Facebook: Polls"><img src="http://static.ak.facebook.com/images/business_portal/polls_48.png?12:67999" style="vertical-align: middle;" height="42" width="48"> Polls</a></li></ul><p>Platform and Polls are old news to anyone following the company, so the really interesting news is in the other four. All of them are very much interlinked, so that you create a Page for your brand or product, advertise it through Social Ads to a very targeted market, learn about your success through Insights, and connect to your off-Facebook (off-Book?) service via Beacon, build custom apps for your Page on Platform, and learn about your users through Polls. It's a marketer's dream, but what does it mean for you as a user? The web is somewhat up in arms about Beacon particularly because it just stinks of privacy violations, at least if you care about things like companies tracking your every move online. This post is going to dig deep in Beacon and see what makes it tick from a purely technical perspective, but we'd be happy to do a follow-up post about the ethical question if there's enough interest. Leave a comment and let us know!</p><br /><br /><h2>Pinging Beacon</h2><p>This post is an in-depth look at Beacon, and is broken down into a few sections to make it easier for you to navigate:</p><br /><ul><li><a href="http://www.radiantcore.com/blog/archives/23/11/2007/deconstructingfacebookbeaconjavascript#nutshell" title="Beacon in a Nutshell">Beacon in a Nutshell:</a> an overview of Beacon and a visual tour of the user interface elements</li><li><a href="http://www.radiantcore.com/blog/archives/23/11/2007/deconstructingfacebookbeaconjavascript#10000" title="Beacon from 10,000 Feet">Beacon from 10,000 Feet:</a> a look at the technology behind Beacon from way up high. Read this if you don't want the finer details but do want an idea of how it works.</li><li><a href="http://www.radiantcore.com/blog/archives/23/11/2007/deconstructingfacebookbeaconjavascript#blocking" title="Blocking Beacon">Blocking Beacon:</a> if you're concerned about privacy and want to stop Beacon, check this part out.</li><li><a href="http://www.radiantcore.com/blog/archives/23/11/2007/deconstructingfacebookbeaconjavascript#code" title="Walking through the Code">Walking through the Code:</a> this is the section for you if you're the type of person who loves reading code listings and wants to know exactly what makes it tick.</li></ul><br /><br /><h2><a name="nutshell"></a>Beacon in a Nutshell</h2><p>Here's what Facebook has to say:</p><blockquote>Allow your customers to share with their friends the actions they take on your website. For user actions you define, Facebook Beacon will publish a story in the user's profile and to friends' News Feeds with a link back to your site.</blockquote><p>What that means in real terms, is that you can add a recipe to your recipe box on <a href="http://www.epicurious.com" title="Epicurious">Epicurious</a>, and you'll get a very familiar looking Facebook pop-up in the bottom right corner of your window letting you know that your new recipe is being sent to your news feed:</p><br /><br /><p style="text-align: center;"><img src="http://www.radiantcore.com/images/blogposts/facebookBeacon/facebook-toast.png" alt="Facebook Beacon Pop-up Window (a.k.a. Toast)" height="134" width="366"></p><br /><br /><p>If you do nothing, you have effectively opted-in and you have consented for the item to be published (i.e.: Facebook will assume your consent to publish the content). The window will disappear eventually, and the next time you log into Facebook, you'll see a notice like this one at the top of your homepage:</p><br /><br /><p style="text-align: center;"><img src="http://www.radiantcore.com/images/blogposts/facebookBeacon/facebook-notification.png" alt="Facebook Epicurious Notification" height="70" width="441"></p><br /><br /><p>If you go to your Profile page, the items will appear mixed in with everything else in you mini-feed:</p><br /><br /><p style="text-align: center;"><img src="http://www.radiantcore.com/images/blogposts/facebookBeacon/facebook-mini-feed.png" alt="Facebook Mini-Feed" height="36" width="381"></p><br /><br /><p>You'll notice that those two screen captures show different recipes being added, which is because Beacon isn't entirely without issues. Although I've been playing with it for a few hours now, items about Epicurious recipes stopped being added to my feed just after 7:30pm. There may be some internal limitations applied by the algorithm to stop feeds from being overloaded with actions from any one site, or it might just be broken :). The <a href="http://www.epicurious.com/services/help/facebook" title="Epicurious: Facebook Action Sharing and Story Publishing">help page</a> on Epicurious explains that they are sending four types of actions to Facebook:</p><br /><ol>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;<li>Rate a recipe</li>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; <li>Review a recipe</li>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; <li>Add a recipe to your Recipe Box</li>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; <li>Register on Epicurious</li></ol><br /><br /><p>Encounters with Beacon are slowly starting to be reported on other sites as well. A post from yesterday on Groundswell documents a <a href="http://blogs.forrester.com/charleneli/2007/11/close-encounter.html" title="Groundswell: Close encounter with Facebook Beacon">Close encounter with Facebook Beacon</a> in which <a href="http://www.forrester.com/rb/analyst/charlene_li" title="Charlene Li">Charlene Li</a> (Vice President, Principal Analyst for Forrester Research) had her first run-in on <a href="http://www.overstock.com" title="Overstock.com">Overstock.com</a>. In her post, she explains how she bought a coffee table from that site and was surprised to discover, when she logged into Facebook later that week, that there was a notice at the top of her page about the purchase:</p><br /><br /><p style="text-align: center;"><img src="http://www.radiantcore.com/images/blogposts/facebookBeacon/facebook-overstock.jpg" alt="Charlene's Facebook Mini-Feed" height="118" width="440"></p><br /><br /><p>Charlene should have been shown the pop-up window as well but she might have missed it or something might have failed to show it while she was on Overstock (there's a slight delay before it pops up, so it's possible that she navigated away from the page or closed the window before she saw it). It's unfortunate that it didn't work as advertised because, as she says:</p><blockquote>The biggest problem is the lack of transparency. Facebook is right in that I would really like to have some things that I do on third party sites to conveniently appear in newsfeed, e.g. events I'm attending from Evite or eBay/craigslist listings so that my friends know about them. That's the promise of Beacon. But I need to be in control and not get blindsided as I did in the example above. I was seriously wigged out, but wouldn't have been if Overstock had simply told me that they were inserting a Facebook Beacon and given me the opportunity at that time to opt-in to Beacon.</blockquote><p>As I mentioned above, this isn't a post about the privacy or security concerns of Beacon (though it will address some of them below). There's some pretty neat web technology at play which we thought would interest our more technical readers, and so, just like we used to do with Dad's calculator we're going to take Beacon apart and put it back together again (hopefully in one piece – sorry Dad!).</p><br /><br /><h2><a name="10000"></a>Beacon from 10,000 Feet</h2><p>That basically wraps up our tour of how Beacon does what it does. It's a fairly long explanation, so here's a quick summary:</p><br /><ol>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; <li>The partner site page includes the beacon.js file, sets a <pre style="margin: 0px; display: inline;">&lt;meta&gt;</pre> tag with a name, and then calls <em>Facebook.publish_action</em>.</li>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; <li><em>Facebook.publish_action</em> builds a query_params object and then passes it to <em>Facebook._send_request</em>.</li>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; <li><em>Facebook._send_request</em> dynamically generates an <pre style="margin: 0px; display: inline;">&lt;iframe&gt;</pre> which loads the URL http://www.facebook.com/beacon/auth_iframe.php and passes the query_params. At this point, Facebook now knows about the news feed item whether you choose to publish it or not.</li>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; <li>The <pre style="margin: 0px; display: inline;">&lt;iframe&gt;</pre> loads a <em>facebook_helper.html</em> file, which lives on the partner site, and which contains a call to <em>Facebook.process_message_from_helper</em>.</li>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; <li><em>Facebook.process_message_from_helper</em> parses a call to <em>Facebook._perform_action</em> from its own query_string and calls it.</li>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; <li><em>Facebook._perform_action</em> dynamically creates the toast pop-up and displays it in the bottom right corner of the window.</li>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; <li>The user is given the choice of cancelling the publication (i.e.: opting-out), which will cause the item not to appear in their news feed.</li></ol><br /><br /><p>And there you go! A very clever series of steps to allow for a very simple integration by partners and a neat side-step of the Cross-site Scripting security features in modern browsers.</p><br /><br /><h2><a name="blocking">Blocking Beacon</a></h2><p>Those of you wearing tin foil hats (or hats at all, really), are probably wondering how you can block this nefarious beast from spreading all of your secrets. You've got a few options:</p><br /><ul><li><strong>If you're not worried about Facebook knowing what you do but are worried about your friends finding out</strong>, you can go into the <a href="http://www.facebook.com/privacy.php?view=unconfirmed_actions" title="Facebook: Privacy Settings for External Websites">External Websites</a> area of your <a href="http://www.facebook.com/privacy.php" title="Facebook: Privacy">Privacy</a> settings and set specific sites to never publish. They'll only show up after you've triggered them the first time, so the list will only contain sites you've already visited which are Beacon-enabled.</li>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; <li><strong>If you're worried about Facebook and you're friends knowing what you do on other sites</strong>, make sure you don't browse other sites while you're logged into Facebook. When you add a recipe to your recipe box and aren't logged in, a request is still made for the beacon.js file and gets as far as creating the <pre style="margin: 0px; display: inline;">&lt;iframe&gt;</pre> and loading auth_iframe in it, but that page now returns "no user" and the process stops.</li>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; <li><strong>If you're paranoid about the entire process (or don't trust yourself to always log out of Facebook before browsing other sites)</strong>, and you just want to make sure that nothing gets through, and you're using Firefox, follow Nate Weiner's excellent instructions in his <a href="http://www.ideashower.com/blog/block-facebook-beacon/" title="the IDEA SHOWER: Block Facebook Beacon">Block Facebook Beacon</a> post (basically, install the <a href="https://addons.mozilla.org/en-US/firefox/addon/3145" title="Add-ons: BlockSite">BlockSite</a> add-on and add www.facebook.com/beacon/* and facebook.com/beacon/* to the list). If you're running InternetExplorer, you can try following <a href="http://www.mvps.org/winhelp2002/restricted.htm" title="Adding sites to the restricted zone">these instructions</a> to add the same two URLs to your restricted zone, but your life would really be much improved by <a href="http://www.getfirefox.com" title="Get Firefox!">downloading Firefox</a> so I'd recommend you do that instead. <strong>UPDATE: </strong> we've confirmed that the exceptionally useful <a href="https://addons.mozilla.org/en-US/firefox/addon/1865" title="Mozilla Add-ons: AdBlockPlus">AdBlockPlus</a> for Firefox will also block Beacon if you add a pattern for http://*facebook.com/beacon* to the list of filters. The script tag embed for the beacon.js file gets blocked which prevents the rest of the app from working. Note that you can set ABP to be disabled for certain sites (a virtual necessity if you use them often and they have heavy Flash requirements), which will in turn allow Beacon to work.<br /></li></ul><br /><br /><h2><a name="code"></a>Walking Through the Code</h2><p><strong>IMPORTANT NOTE: All of the code shown here is copyright and all rights reserved and please-don't-sue-us owned by the respective parties who wrote and publish it. It was not disassembled for profit and we used only publicly available free tools (<a href="http://www.mozilla.com/firefox/" title="Mozilla Firefox">Firefox</a> with the <a href="http://addons.mozilla.org/firefox/addon/1843" title="Mozilla Add-ons: FireBug">FireBug</a> and <a href="http://addons.mozilla.org/firefox/addon/966" title="TamperData">TamperData</a> Add-Ons installed) and source which was available through standard web protocols.</strong></p><br /><br /><p>It has traditionally been very difficult to connect two websites together and exchange information between them without building complex backend integrations. Sure, they could have built Beacon by implementing a <a href="http://en.wikipedia.org/wiki/Web_service" title="Wikipedia: web service">web service</a> in which the third party servers (like Epicurious) would contact the Facebook services through an entirely backend channel whenever I did a certain something (like add a recipe to my recipe box), but that would have meant asking partners to invest some fairly serious engineering effort in order to support it, and the opportunity to display a fun pop-up window to allow me to opt-out would have been gone. Instead, Facebook followed the route of having partners embed a JavaScript file on their site, and make a simple JavaScript call to populate the item. Let's take a look at an example:</p><br /><br /><p>I'm a big fan of risotto – so big, in fact, that one of the reasons I married my wife was to get better access to her Risotto Milanese. I can't think of anything I'd really rather have for breakfast, so we're going to use a recipe for <a href="http://www.epicurious.com/recipes/food/views/240748" title="Epicurious: Breakfast Risotto">Breakfast Risotto</a> as our example (you should load that page in another tab so that you can flip back and forth).</p><br /><br /><p>If you take a look at the source and search for Facebook, you'll find two entries. The first is on line 133 and sets up the name of this item for the news feed entry:</p><br /><br /><pre>&lt;meta name="facebook_label" content="Breakfast Risotto Recipe"&gt;</pre><br /><p>The second is on line 167 and actually pulls in the Facebook JavaScript file:</p><br /><br /><pre>&lt;script type="text/javascript" src="http://facebook.com/beacon/beacon.js.php?source=5194643289"&gt;&lt;/script&gt;</pre><br /><p>The source ID (5194643289) identifies Epicurious and corresponds to a list maintained internally by Facebook, which allows them to validate sources. You can actually load that file <a href="http://facebook.com/beacon/beacon.js.php?source=5194643289" title="Facebook: beacon.js">directly</a> and you'll find a suprisingly well formatted JavaScript class called window.Facebook. We'll dig into it a little bit later on, but the first method deserves mention all by itself, entirely based on its name:</p><br /><br /><pre>write_awesome : function(url) {<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;return '';<br />},<br /></pre><br /><p>The two lines we're particularly interested in on the Epicurious page have to do with adding this recipe to our recipe box, and you'll find them on lines 1195 and 1197:</p><br /><br /><pre>&lt;a href="javascript:void(0);" id="addRecipeButton"&gt;Save To Recipe Box&lt;/a&gt;<br />&lt;script type="text/javascript"&gt;new LoginRequiredLink('240748',<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;'addRecipeButton',<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;'/user/recipebox/save?id=240748&amp;returnto=/recipes/food/views/240748',<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;'recipeBox',<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;'recipeBox');&lt;/script&gt;</pre><br /><p>For all intents and purposes, this has nothing to do with Beacon and basically just rewrites the addRecipeButton link to point to the right URL for saving it if you're logged in (note: a more modern approach would be to use Ajax to send a message to the server to save this recipe and prevent having to actually go to a different page, which would improve the experience here since the back button from the save page takes you back to effectively the same page in the pre-saved state). If you want to follow the rest of the way through this you're going to need to register an account on Epicurious, so go ahead and do that and I'll wait right here. Done? Great. Reload that page and you should now have an enabled Save to Recipe Box" button. Now, before you go and click on it to watch Beacon in action, you'll need to make sure that you've logged into Facebook in another tab or window. <strong>This is critical and is in fact overlooked by a lot of the people who are upset about the potential privacy violations: don't leave yourself logged into Facebook and you won't have a problem with other people using your machine and logging Beacon events.</strong> Go ahead and login and then hit that button.</p><br /><br /><p>You should now be on a page which shows the recipe as added. There's a lot of Epicurious-centered JavaScript at play on this page which we're not overly concerned about, so I'm not going to mention it except where it affects the Beacon integration. As on the previous page, we have a </p><pre style="margin: 0px; display: inline;">&lt;meta&gt;</pre> tag with the recipe name in it, and the inclusion of the JavaScript file (line 133 and 167 again), but now we have some more code which actually makes the magic happen. The next mention of Facebook is way down on line 1184, in a function called runOnLoad:<p></p><br /><br /><pre>&lt;script language="javascript"&gt;<br />&nbsp;&nbsp;&nbsp; runOnLoad(function() {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (Facebook) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Facebook.publish_action('queue',<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;'http://www.epicurious.com/recipes/food/views/240748?mbid=fbfeed');<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp; });&lt;/script&gt;</pre><br /><p>Basically, if the Facebook object was instantiated when the beacon.js file was included, go ahead and publish an action of type 'queue' with the URL of this page as the link (with a tracker on the end so Epicurious knows you came to the recipe from a Facebook feed). The runOnLoad function gets called down on line 1330 from inside a </p><pre style="margin: 0px; display: inline;">&lt;script&gt;</pre> tag. Now we're making progress! Let's take a look at what the publish_action function does – you'll find it on line 20 of beacon.js in unadulterated form, or right here all marked up:<p></p><br /><br /><pre>publish_action : function(action, urls) {<br />&nbsp;&nbsp;&nbsp; urls = urls || window.location.href;<br /></pre><br /><p>Set the urls variable to the value passed in or the location of the current page.</p><br /><br /><pre>&nbsp;&nbsp;&nbsp; setTimeout(function() {</pre><br /><p>Set a timeout of 50 milleseconds and then call the following function.</p><br /><br /><pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (Facebook._BROADCAST_ACTIONS[action]) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var query_params = [['action_name', action]];</pre><br /><p>Check to see if we were passed a valid type of action and set the action_name to the value passed in. The list of available actions is quite extensive: buy, wish_list, queue, sign_up, bid, review, add, book, comment, create, design, download, find, fly, get, join, play, post, rate, rent, shop, stay, subscribe, support, update, view, vote, watch, enjoy, order.</p><br /><br /><pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (typeof urls == 'object') {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (var i = 0; i &lt; urls.length; ++i) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; query_params = query_params.concat([['urls[' + i + ']', urls[i]]]);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; query_params = query_params.concat([['urls[0]', urls]]);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Facebook._send_request('http://www.facebook.com/beacon/auth_iframe.php', query_params);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp; }, 50);},<br /></pre><br /><p>Manipulate the URL if required to build the request and then send it to facebook using the _send_request function.</p><br /><br /><br /><p>The next piece of code is key to how this whole thing works. Those of you familiar with JavaScript will know that browsers spend a lot of effort preventing something called Cross-Site Scripting (often shortened to XSS). We covered this back in July 2006 with a post on <a href="http://www.radiantcore.com/blog/archives/18/07/2006/5xsstips" title="5 Tips for Protecting Your Site Against XSS">5 Tips for Protecting Your Site Against XSS</a>, and Wikipedia has an excellent a very in-depth look at the issue in their <a href="http://en.wikipedia.org/wiki/Cross_site_scripting" title="Wikipedia: Cross-site Scripting">Cross-site Scripting</a> entry. The gist of it is that you can't have a script from one site run on another site and you can't drop a cookie from one site and read it from another, so how does your news event from Epicurious get posted into Facebook without using a backend server connection? All thanks to the humble _send_request function (line 75 in beacon.js):</p><br /><br /><pre>_send_request : function(url, query_params) {<br />&nbsp;&nbsp;&nbsp; query_params = query_params.concat([['source_id', Facebook._source_id],<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ['random', Math.random()],<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ['ref_url', window.location.href]]);<br />&nbsp;&nbsp;&nbsp; var src = url + '?' + Facebook._form_query_string(query_params);<br /></pre><br /><p>This is pretty simple – parse the info handed to this function and get ready for below.</p><br /><br /><pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; setTimeout(function() {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var ifr = document.createElement('iframe');<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ifr.style.display&nbsp;&nbsp;&nbsp;&nbsp; = 'block';<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ifr.style.width&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = '0px';<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ifr.style.height&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = '0px';<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ifr.style.border&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = '0px';<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ifr.style.margin&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = '0px';<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ifr.style.padding&nbsp;&nbsp;&nbsp;&nbsp; = '0px';<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ifr.style.overflow&nbsp;&nbsp;&nbsp; = 'hidden';<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ifr.style.visibility&nbsp; = 'hidden';<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ifr.src = src;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; document.body.appendChild(ifr);<br />&nbsp;&nbsp;&nbsp; }, 0);<br />},<br /></pre><br /><p>This is where it all goes down. This code creates an </p><pre style="margin: 0px; display: inline;">&lt;iframe&gt;</pre> on the fly and inserts into the document, using the URL that got passed in from publish_action above.<p></p><br /><br /><p>So, an </p><pre style="margin: 0px; display: inline;">&lt;iframe&gt;</pre> on the page loads content from the Facebook server, getting passed in the action you performed and the URL to link back to. If you look above, you'll see that the <pre style="margin: 0px; display: inline;">&lt;iframe&gt;</pre> is loading content from <a href="http://www.facebook.com/beacon/auth_iframe.php" title="Facebook: auth_iframe.php">http://www.facebook.com/beacon/auth_iframe.php</a>, which you can try to load directly but will likely get an "invalid ref url" error. We can fake it out by passing in the same values which would be built into query_params and passed in: <a href="http://www.epicurious.com/facebook_helper.html?function_name=_perform_action&amp;arg1=null&amp;arg2=a%3A2%3A%7Bi%3A0%3Bi%3A1858902535%3Bi%3A1%3Bs%3A64%3A" b7181317b360040b558a92dcbe83c8c71c5302bc81a663a0c3f9d248c7339551="" %3b}&amp;random="1609429394&quot;" title="Facebook: auth_iframe.php full URL">http://www.epicurious.com/facebook_helper.html?function_name=_perform_action&amp;arg1=null&amp;arg2=&lt;auth_token_redacted&gt;&amp;random=1609429394</a>. Two notes: 1) There's a piece in the URL which looks like it's encoded in <a href="http://en.wikipedia.org/wiki/Json" title="Wikipedia: JSON">JavaScript Object Notation (JSON)</a>, which I've removed for publishing this post. It's impossible to tell by looking at it, but it might contain a key which relates back to my Facebook account. It's not needed for the purposes of understanding the functionality, and if you'd really like to see what it looks like, you can recreate the steps up to this point and check it out for yourself. 2) You'll need to use a URL Encoder to pass in the ref_url parameter – I usually use Eric Meyer's <a href="http://meyerweb.com/eric/tools/dencoder/" title="Meyerweb: URL"> Decoder/Encoder</a>. If you follow that URL, you'll get a page with a simple block of HTML on it, which is what loads in the <pre style="margin: 0px; display: inline;">&lt;iframe&gt;</pre> (it will make a blank page in your browser – view source to see what's in it):<p></p><br /><br /><pre><!--Install this file onto your domain if you want to broadcast your user actions to Facebook.-->&lt;html&gt;&lt;body&gt;&lt;script type="text/javascript"&gt;window.onload = function() {<br />&nbsp;&nbsp;&nbsp; window.top.Facebook.process_message_from_helper(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; window.location.search.substring(1),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; window.location.hash.substring(1));}&lt;/script&gt;<br />&lt;/body&gt;&lt;/html&gt;</pre><br /><p>Nice and short: when the page loads into the </p><pre style="margin: 0px; display: inline;">&lt;iframe&gt;</pre>, call the process_message_from_helper function in the Facebook object at the top level of this window (being the page on Epicurious which instantiated the <pre style="margin: 0px; display: inline;">&lt;iframe&gt;</pre>). You may not have known that window.location had a bunch of really useful properties within it, including search (everything in the query string of a URL, or after the ?), and hash (the anchor tag on a page, or everything after the #). Back to the beacon.js file, line 290:<p></p><br /><br /><pre>process_message_from_helper : function(query_string, hash_string) {<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;var params = Facebook._parse_query_string(query_string);<br /></pre><br /><p>Facebook._parse_query_string is to an internal function (beacon.js, line 276) which pulls about the key/value pairs from the query string (e.g."action_name=queue") and returns an array containing the key and value (e.g.: ["action_name", "queue"]).</p><br /><br /><pre>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;var argument_list = [];<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;var function_name = '';<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;for (var i = 0; i &lt; params.length; ++i) {<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;var key = params[i][0];<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;var val = params[i][1];<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;if (key.substring(0, 3) == 'arg') {<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;argument_list[parseInt(key.substring(3))] = val;<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}</pre><br /><p>Some of the keys stored in the query_string start with 'argx' to denote that they arguments (where x is an integer indicating which argument this is – arg0, arg1, arg2, etc.). If that's the case, store the value in the argument_list array at that location (e.g.: arg0 goes into the argument_list[0]).</p><br /><br /><pre>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;if (key == 'function_name') {<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;function_name = val;<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;}<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;}<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;Facebook[function_name].apply(null, argument_list);<br />}</pre><br /><p>If the key is 'function_name', then we want to call that function in the Facebook object. That </p><pre style="margin: 0px; display: inline;">if</pre> really could have been an <pre style="margin: 0px; display: inline;">else</pre> (extending the previous <pre style="margin: 0px; display: inline;">if</pre>) since it's impossible for the key to start with arg and be equal to 'function_name', but maybe there's more code to come or something has been removed. Either way, the final step is to call any functions that got passed in and pass them the argument_list which we've built up.<p></p><br /><br /><p>It's interesting to note that none of the arguments which got stored when we built the query_string above started with arg or had a key of function_name. Since we had to fake our way into seeing the auth_iframe.php page, we didn't get a look at the full set of arguments passed into it from Epicurious. The trail would have gone cold here, were it not for the wonderful Firefox add-on called <a href="http://addons.mozilla.org/firefox/addon/966" title="Add-ons: TamperData">TamperData</a>. With the add-on installed and the sidebar open, you can watch all of the GET and POST requests that a page makes as it loads. The recipe save page from Epicurious makes 116 requests to build the page, pulling from three servers (www.epicurious.com, www.google-analytics.com, and www.facebook.com). We only really care about the ones made to Facebook, of which there are 6. The GET call to auth_iframe.php is the one we're after, and it looks like this:</p><br /><br /><blockquote>http://www.facebook.com/beacon/auth_iframe.php?action_name=queue<br />&amp;urls[0]=http%3A%2F%2Fwww.epicurious.com%2Frecipes%2Ffood%2Fviews%2F240748%3Fmbid%3Dfbfeed<br />&amp;source_id=5194643289<br />&amp;random=0.2268030104517741<br />&amp;ref_url=http%3A%2F%2Fwww.epicurious.com%2Frecipes%2Ffood%2Fviews%2F240748%3Frecipename%3DBREAKFAST%2520RISOTTO%26saved_to_box%3Dy</blockquote><br /><p>Which is not dissimilar to the version we constructed. Thanks to TamperData, we can get the response to that request, which contains the following location:</p><br /><br /><blockquote>Location=http://www.epicurious.com/facebook_helper.html?function_name=_perform_action<br />&amp;arg0=queue<br />&amp;arg1=%5B%22http%3A%5C%2F%5C%2Fwww.epicurious.com%5C%2Frecipes%5C%2Ffood%5C%2F<br />views%5C%2F240748%3Fmbid%3Dfbfeed%22%5D<br />&amp;arg2=&lt;auth_token_redacted&gt;<br />&amp;random=1305590124</blockquote><br /><p>When the call gets made from Epicurious rather than by us, the response fits right into the pattern that process_message_from_helper is looking for. In fact, if you go to <a href="http://www.epicurious.com/facebook_helper.html?function_name=_perform_action&amp;arg0=queue&amp;arg1=%5B%22http%3A%5C%2F%5C%2Fwww.epicurious.com%5C%2Frecipes%5C%2Ffood%5C%2Fviews%5C%2F240748%3Fmbid%3Dfbfeed%22%5D&amp;arg2=%3Cauth_token_redacted%3E&amp;random=1305590124" title="Facebook_helper on Epicurious">that URL</a> and view the source, you'll seem the same thing we saw when we loaded auth_iframe directly, except now being served from Epicurious instead of Facebook. Applying what we know from process_message_from_helper, we've now essentially called:</p><br /><br /><pre>_perform_action(queue, ["http://www.epicurious.com/recipes/food/views/240748?mbid=fbfeed"], &lt;auth_token_redacted&gt;, 1305590124);</pre><br /><p>Note that we've made a trip through the Facebook server to get here, which means Facebook has already recorded this news feed item whether we choose to publish it or not. This is a much longer function so I've edited out some parts which are not key to the core functionality. If you'd like to see the whole thing, we're now on line 159 of beacon.js. One thing to note before we dive in: the term 'toast' will only make sense if you've actually seen the pop-up appear. Since it rises up from the bottom edge of the window frame, it looks a lot like toast popping up in a toaster :)</p><br /><br /><pre>_perform_action : function(action_name, urls, auth_token) {<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;Facebook._kill_toast();</pre><br /><p>Although it may sound like it, no one at Facebook has a vendetta against breakfast foods (that we know of). This just kills the window if it's already visible from a previous instantiation.</p><br /><br /><pre>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; var toast = Facebook._toast = document.createElement('div');<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; var query_param = [['action_name', action_name],<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; ['urls', urls],<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; ['source_id', Facebook._source_id],<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; ['ref_url', window.location.href],<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; ['random', Math.random()]];<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; if (auth_token) {<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; query_param.push(['auth_token', auth_token]);<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; }<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; var src = Facebook._action_toast_url + '?' + Facebook._form_query_string(query_param);<br /></pre><br /><p>Create the HTML element that will hold our toast, then setup the query_params. The toast window contains another </p><pre style="margin: 0px; display: inline;">&lt;iframe&gt;</pre> into which we will once again pass our familiar query_params (see below). The next block is formatting for the <pre style="margin: 0px; display: inline;">&lt;iframe&gt;</pre> and has been removed.<p></p><br /><br /><pre>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; [...redacted...]<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; var iframe_style = 'width: 345px; height: auto; left: 0px;'<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;+ 'border: 0px; margin: 0px; padding: 0px; display: block; position: absolute; background: transparent;';<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; toast_inner.innerHTML = '&lt;iframe src="%27%20+%20src%20+%20%27" style="" <br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;allowtransparency="true" frameborder="0" scrolling="no"&gt;&lt;/iframe&gt;';</pre><br /><p>Format the </p><pre style="margin: 0px; display: inline;">&lt;iframe&gt;</pre> and then set the innerHTML of the inside of our toast window to contain it, passing in the src variable defined above. _action_toast_url is defined in beacon.js as http://www.facebook.com/beacon/action_toast.php.<p></p><br /><br /><pre>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; var iframe = Facebook._toast_iframe =<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; toast_inner.getElementsByTagName('iframe')[0];<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; iframe.style.bottom = '-150px';<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; toast.appendChild(toast_inner);<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; document.body.appendChild(toast);<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; [...redacted...]<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; }}<br /></pre><br /><p>Lastly, append the inner_toast div to the toast div which we created at the top. The next block calculates the position of the div and sets some style values.</p><br /><br /><p>We're almost done, honest. Referring back to our TamperData output, the URL for the </p><pre style="margin: 0px; display: inline;">&lt;iframe&gt;</pre> in the toast window that actually gets called by Epicurious is:<p></p><br /><br /><pre>http://www.facebook.com/beacon/action_toast.php?action_name=queue&amp;urls=["http%3A%2F%2Fwww.epicurious.com%2Frecipes%2Ffood%2F<br />views%2F240748%3Fmbid%3Dfbfeed"]&amp;source_id=5194643289&amp;ref_url=http%3A%2F%2Fwww.epicurious.com%2Frecipes%2Ffood&gt;%2Fviews%2F240748%3F<br />recipename%3DBREAKFAST RISOTTO%26saved_to_box%3Dy&amp;random=0.820036078758848&amp;auth_token=&lt;auth_token_redacted&gt;</pre><br /><p>If you were logged into Facebook, and I hadn't removed the auth_token, and you load that URL in a window, you would probably see the contents of the toast window rendered in all of its glory. Since you can't do that, I'll just repeat the screenshot of the toast window from above:</p><br /><br /><p style="text-align: center;"><img src="http://www.radiantcore.com/images/blogposts/facebookBeacon/facebook-toast.png" alt="Facebook Beacon Pop-up Window (a.k.a. Toast)" height="134" width="366"></p><br /><br /><p>You have five options at this point:</p><br /><ol>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; <li><strong>Close:</strong> closes the toast window and sends the news item to your news feed.</li>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; <li><strong>Learn More:</strong> takes you to a page on the Epicurious site with more information about the Facebook integration (<a href="http://www.epicurious.com/services/help/facebook" title="Epicurious: Facebook Action Sharing and Story Publishing">Facebook Action Sharing and Story Publishing</a>).</li>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; <li><strong>This isn't me:</strong> pops up a new window with a Facebook login in it so that you can login and add the item to your own news feed. This closes the toast window, but closing the login window without logging in didn't seem to log me out of Facebook. The recipe hasn't shown up in my feed, so I'm assuming that still blocked it from being published.</li>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; <li><strong>No Thanks:</strong> closes the toast window and stops the story from being published.</li></ol><br /><br /><p>One important privacy consideration, despite this not being a privacy post, is that Facebook still knows that you added a recipe to your recipe box (or bought a book on Amazon, or a coffee table on Overstock.com, even if block the item from being posted to your news feed. I haven't seen any evidence here that shows that Beacon is sending along anything other than basically an action type, a name (in the </p><pre style="margin: 0px; display: inline;">&lt;meta&gt;</pre> tag), and a URL to link the name to, but that doesn't mean that it isn't hiding it in some of the encoded values along the way. Also, adding recipes to your recipe box is a lot more innocent than, say, purchasing adult DVDs or registering for Monster.com when you already have a job, so carefully consider what information you're broadcasting.<p></p><br /><br /><h2>Wrapping Up</h2><p>That well and truly brings us to the end of our look at Facebook Beacon. It seems impossible that you might have read all this way down and not have been lulled into sleep, but if you're still awak (hi!) and have questions, leave them in the comments below and I'll do my best to answer them. If you're interested in reading more about this topic, and particularly about the privacy concerns or integration between Beacon and the other Business tools, let me know! Thanks for reading :)</p>]]></description>
				<category>Facebook, JavaScript</category>
				<pubDate>Fri, 23 Nov 2007 17:00:00 GMT</pubDate>
			</item>
		
			
			
			
			
			
			
			
			

			
				
			
			<item>
				<title><![CDATA[Microsoft User Experience Round Table Trip Report Part 5: Wrapping Up]]></title>
				<author>Jay Goldman &lt;info@radiantcore.com&gt;</author>
				<link>http://www.radiantcore.com/blog/archives/16/03/2007/msuxroundtablereport5</link>
				<guid isPermaLink="true">http://www.radiantcore.com/blog/archives/16/03/2007/msuxroundtablereport5</guid>
				<comments>http://www.radiantcore.com/blog/archives/16/03/2007/msuxroundtablereport5#comments</comments>
				<description><![CDATA[<div id="syndicatePage">This is the fifth and final post in the <a href="http://www.radiantcore.com/blog/archives/12/03/2007/msuxroundtablereport1" title="Radiant Core Blog: Microsoft UX Round Table">Microsoft UX Round Table</a> series.</div><br /><br /><p>What a week it's been! Had I known that it was going to take me about 25 pages and 7,000 words to describe our trip, I never would have volunteered for this gig :) I hope you've enjoyed reading through this as much as I've enjoyed putting it together and that this information is of value to some of you out there. Today is the final post in this series and provides a blissfully short summary, so if you're only going to read one of the five posts, make it this one (although you'll miss the Ali G clip).</p><br /><br /><h2>The New Microsoft (Again)</h2><p>In <a href="http://www.radiantcore.com/blog/archives/13/03/2007/msuxroundtablereport2" title="The New Microsoft (Again)">Tuesday's post</a>, I talked about how Microsoft is turning a new leaf and repositioning themselves as a design-focused organization. I touched on how there's a lot of new blood breathing life into the beast and how they are making massive investments into UX for high-risk products like <a href="http://office.microsoft.com/products" title="Microsoft: Office 2007">Office 2007</a> and the <a href="http://office.microsoft.com/en-us/products/HA101679411033.aspx" title="Microsoft: The new Microsoft Office user interface overview">Ribbon</a>.&nbsp; I covered the development of the <a href="http://firstlook.nytimes.com/?category_name=times%20reader" title="NYT: Times Reader Beta">NYT Reader</a> application and how it carefully balances layout and readability issues with brand and content. These are both examples of the positive impact that design can have when factored into your process and a very elementary and basic level and I applauded Microsoft for their efforts. You can find out a little more about their new focus in the <a href="http://www.microsoft.com/design/" title="Microsoft: Design Center">Microsoft Design Center</a> website.</p><br /><br /><h2>Design Matters (Maybe?)</h2><p> In <a href="http://www.radiantcore.com/blog/archives/14/03/2007/msuxroundtablereport3" title="Design Matters (Maybe?)">Wednesday's post</a>, I provide the corollary in which I talked about how we saw an equal number of examples where design (and UX specifically) had not been taken into account. We looked at the <a href="http://www.microsoft.com/virtualearth/" title="Microsoft: Virual Earth">Virtual Earth</a> Windows Vista <a href="http://gallery.live.com/default.aspx?l=1" title="Microsoft: Gadget Library">Gadget</a> which violates the <a href="http://msdn2.microsoft.com/en-us/aa370759.aspx" title="Microsoft: User Experience Guidelines for Gadgets">User Experience Guidelines for Gadgets</a>, and at <a href="http://www.microsoft.com/products/expression/en/Expression-Blend/default.mspx" title="Microsoft: Expression Blend">Expression Blend</a> which seems to be aimed at the very broad demographic of 'designers' without much consideration as to who that might be specifically. And I managed to sneak in an <a href="http://www.youtube.com/watch?v=nkuOuxRD1Bc" title="YouTube: Ali G invents the ice cream glove">Ali G clip</a> about ice cream gloves that's still making me laugh a full 24 hours later.</p><br /><br /><h2>Expression</h2><p> In <a href="http://www.radiantcore.com/blog/archives/15/03/2007/msuxroundtablereport4" title="Expression">Thursday's post</a>, I gave a review of the new <a href="http://www.microsoft.com/products/expression/en/expression-studio/default.mspx" title="Microsoft: Expression Studio">Expression Studio</a> suite, which includes the <a href="http://www.microsoft.com/products/expression/en/expression-web/default.mspx" title="Microsoft: Expression web">Web</a>, <a href="http://www.microsoft.com/products/expression/en/expression-design/default.mspx" title="Microsoft: Expression Design">Design</a>, <a href="http://www.microsoft.com/products/expression/en/expression-blend/default.mspx" title="Microsoft: Expression Blend">Blend</a>, and <a href="http://www.microsoft.com/products/expression/en/expression-media/default.mspx" title="Microsoft: Expression Media">Media</a> products. I liked Web but wished for a Mac OS X version, thought Design was an Illustrator knock-off with the sole advantage of being able to handle XAML, felt that Blend would be a useful tool for us if we built Windows applications, and wished that Media provided the ability to easily work from shared catalogues.</p><br /><br /><h2>Wrapping Up</h2><p>It's been almost a month since our trip which has given me a fair bit of time to think about what we'd seen and heard. The last five days have really helped me to form some conclusions and I think, in the end, the experience was exactly what I expected it to be. It was an honour to be invited to participate and I hope that I have other opportunities to do the same with Microsoft and with other firms (though I might hold off on the epic blog post series after!). It's not often that you have an opportunity to peek inside the kimono of a big software company and to get a sense of what they're thinking and working on. Like it or not, almost all of us use their software every day of our lives and they have shaped our industry like no other force. I have a lot of respect for the Microsofties and this trip reinforced that they burn their torches with the same passion and strength of belief as our colleagues in the Open Source world.</p><br /><br /><p><a href="http://www.radiantcore.com/blog/authors/mkewart" title="Martin Kuplens-Ewart">Martin</a> joked that I should end the series with a surprise announcement that Radiant Core was going to ditch our Macs and switch over to Windows and I really thought about it (the joke announcement, not the reverse-switch), but in the end I was worried that I'd have a revolt on my hands. The truth is that even after two days of learning about their products and plans, I still don't really get it. One of our fellow attendees, <a href="http://atomiq.org/" title="Gene's blog">Gene Smith</a>, commented that I was <a href="http://atomiq.org/archives/2007/03/links_for_20070314.html" title="Atomiq: links for 2007-03-14">under-reporting the general scepticism in the room</a> and I think he was right. Those of us in the industry, especially my fellow UX folk, have grown used to expecting little from Microsoft and being underwhelmed. The video which Microsoft produced as a study of their own bloated box design, entitled <a href="http://www.youtube.com/watch?v=aeXAcwriid0" title="YouTube: Microsoft re-designs the Microsoft iPod 2005 Package">Microsoft re-designs the Microsoft iPod 2005 Package</a>, was brilliant not only because it was funny but because it was true. Apple is smaller than Microsoft by several orders of magnitude and has a fraction of their cash reserves and market share, and yet they consistently lead their industry because Apple builds products which people <strong>love</strong>. We are victims of marketing as much as anything else, but Apple is cool and hip and now and Microsoft is increasingly becoming boring, square, and then. The <a href="http://www.apple.com/getamac/" title="Apple: Get a Mac">Mac vs. PC</a> ad campaign is winning people over, not because Macs are necessarily better at photos and video, but because people want to buy into the belief that they are. This is an important point: other than the XBOX 360, people don't tend to have an overwhelmingly positive emotional response to Microsoft's products and they don't inspire the unbridled want lust in the way that only the <a href="http://www.apple.com/iphone" title="Apple: iPhone">iPhone</a> can. At the end of the day, we run our business on Mac OS X and Apple hardware because it <strong>is</strong> easier to use, because it just works when we need it to, and because we have far fewer issues and tech support calls than we ever did running Windows. I started this series off by saying that I was no longer the Jobs worshipping, Apple flag waving fan boy that I used to be and that's definitely true. This conclusion isn't an attempt to sell you on making a switch or on how clever we are for our platform decision, though it would have been in days of yore. Bear with me for a moment while I bring us around to the final thoughts.</p><br /><br /><p><strong>We believe in Open in all of its forms.</strong> We use an operating system which is built on top of an Open Source kernel (<a href="http://en.wikipedia.org/wiki/Mac_OS_X" title="Wikipedia: Mac OS X">Mac OS X</a> runs on top of the <a href="http://en.wikipedia.org/wiki/Darwin_%28operating_system%29" title="Wikipedia: Darwin Operating System">Darwin</a> kernel which Apple released in 2000 under the <a hreg="http://en.wikipedia.org/wiki/Apple_Public_Source_License" title="Wikipedia: Apple Public Source License">Apple Public Source License</a>). We run an Open Source web browser which we helped to develop (<a href="http://www.mozilla.com/en-US/firefox/" title="Mozilla: Firefox">Mozilla Firefox</a> is released under the <a href="http://en.wikipedia.org/wiki/Mozilla_Public_License" title="Wikipedia: Mozilla Public License">Mozilla Public License</a>). We currently build our software on a stack which rests on the most popular web server in the world (<a href="http://www.apache.org/" title="Apache">Apache</a> is released under the <a href="http://www.apache.org/licenses/" title="Apache: Licenses">Apache License Version 2.0</a>), includes an Open Source Java Application Server (<a href="http://tomcat.apache.org/" title="Apache: Tomcat">Tomcat</a> is also part of the Apache project) and an Open Source database (<a href="http://www.mysql.com/" title="MySQL">MySQL</a> is released under the <a href="http://en.wikipedia.org/wiki/Gpl" title="Wikipedia: GNU General Public License">GNU General Public License</a>). We write our software in a (mostly) Open Source language (<a href="http://java.sun.com/" title="Sun: Java Technology">Java</a> was <a href="http://www.sun.com/2006-1113/feature/" title="Sun: Sun Opens Java">recently released under the GNU GPL Version 2</a>) and develop in an Open Source development environment (<a href="http://www.eclipse.org/" title="Eclipse">Eclipse</a> started life as an IBM project and is released under the <a href="http://www.eclipse.org/legal/epl/notice.php" title="Eclipse: Eclipse Public License">Eclipse Public License</a>). We are very active members of the <a href="http://www.barcamp.org" title="BarCamp: Wiki">BarCamp</a> community in <a href="http://barcamp.pbwiki.com/TorCamp" title="BarCamp: TorCamp Home">Toronto</a> and around the world and we dedicate a fair portion of our time to promoting the adoption of Open outside of our industry by organizing events like <a href="http://toronto.transitcamp.org/" title="TransitCamp: Wiki">TransitCamp</a>. We believe so strongly in this movement that we are exploring the possibility of releasing <a href="http://www.radiantcore.com/foundation" title="Foundation Website Management Platform">Foundation</a>, our Website Management Platform, under an Open Source License before the end of 2007.</p><br /><br /><p>Microsoft is typically held up as the counter-example to the Open Source world in that their business practises in the past have been very closed, proprietary, and predatory. The decision to make Expression Web speak standard XHTML is a very good one and the right thing to do, but it's tempered by the decision to build the Expression Suite on <a href="http://en.wikipedia.org/wiki/XAML" title="Wikipedia: XAML">XAML</a>, a proprietary file format published for use by the public. They occupy a strange position in the technology universe, balanced on both sides of a dichotomy in which their <a href="http://research.microsoft.com/" title="Microsoft: Research">Research</a> labs are building some of the most innovative software in the world and yet their product divisions build products which engender little interest from consumers (<a href="http://www.zune.net/en-US/" title="Zune: Welcome to the Social">Zune</a>) or fall short of expectations (<a href="http://www.microsoft.com/windows/products/windowsvista/default.mspx" title="Microsft: Windows Vista">Vista</a>). There are rumbles out there that say Microsoft has lost their mojo and are becoming less and less relevant in a world which is focused on the web and which is starting to show a stronger and stronger interest in the value of capital-D Design (led by companies like <a href="http://www.apple.com" title="Apple">Apple</a>, <a href="http://www.oxo.com/" title="Oxo Good Grips">Oxo</a>, and <a href="http://nymag.com/nymetro/health/features/11700/" title="NYMag: Target ClearRx">Target</a> just to name a few). I think there's some truth to those suspicions and you don't need a richter scale to measure them: just compare the worldwide festivities of the Windows 95 or XP launches to the downright mellow and uninspiring "The Wow is Now" campaign for <a href="http://www.microsoft.com/windows/products/windowsvista/default.mspx" ttle="Microsoft: Vista">Vista</a>. Other than the work coming out of the Research labs and XBOX teams, Microsoft is not an innovative company. I had this conversation with a few of my fellow attendees over drinks and the best examples they could come up with to defend innovation at MS were in the data warehousing field. I didn't argue - and I'm sure they're important to Data Warehousers - but that's not much of a defence. Focusing on design is a good move (even if it is playing catch up) but it needs to be a move which starts at the very top of the organization and which inspires everyone to take part. What we were shown during our visit was a great beginning and time will tell where it leads, but given that they are a technology company driven forward by the development of technology, I suspect that it will fall short if the hardcore developers within the company don't buy into it. Bill Gates is worshipped within the organization as the Alpha Geek and his <a href="http://www.usdoj.gov/atr/cases/exhibits/20.pdf" title="DOJ: Internet Tidal Wave memo (PDF)"><em>Internet Tidal Wave</em></a> memo successfully mobilized Microsoft to make an enormous course change in 1995 - where's the <em>Design Tsunami</em> equivalent?</p><br /><br /><p>That's it for Day 5 and the Microsoft Trip Report series! Subscribe to our <a href="http://feeds.feedburner.com/RadiantCore" title="FeedBurner: Radiant Core RSS Feed">RSS feed</a> to make sure that you don't miss out on future insights from the Radiant Core.</p>]]></description>
				<category>Trip Reports, User Experience, Taking Care of Business</category>
				<pubDate>Fri, 16 Mar 2007 09:00:00 GMT</pubDate>
			</item>
		
			
			
			
			
			
			
			
			

			
				
			
			<item>
				<title><![CDATA[Fixing an IE 7 bug in mm_menu.js navigation]]></title>
				<author>Martin Kuplens-Ewart &lt;info@radiantcore.com&gt;</author>
				<link>http://www.radiantcore.com/blog/archives/16/02/2007/ie7mmmenu</link>
				<guid isPermaLink="true">http://www.radiantcore.com/blog/archives/16/02/2007/ie7mmmenu</guid>
				<comments>http://www.radiantcore.com/blog/archives/16/02/2007/ie7mmmenu#comments</comments>
				<description><![CDATA[We're proud (even stubborn) hand-coders, so we don't often get the opportunity to delve into the JavaScript libraries deployed by using applications such as Dreamweaver.<br /><br />Recently, however, we were contacted with an IE7 bug: a navigation system that was using the mm_menu.js library appeared to be only showing the first word of each option.<br /><br />At 800 lines of dense JavaScript, this was not going to be fun to debug. Fortune, however, smiled upon us in the form of an invidual named Hiroto, who posted the following <a href="http://www.cre8asiteforums.com/forums/lofiversion/index.php/t42213.html">on the Cre8asite Forums</a>:<br /><br /><blockquote>function writeMenus(container) {<br />&nbsp;&nbsp;&nbsp;&nbsp;.... some code here ....<br />&nbsp;&nbsp;&nbsp;&nbsp;menu.menuItemHeight = menu.menuItemHeight || defaultHeight;<br />&nbsp;&nbsp;&nbsp;&nbsp;var itemProps = ''; <span style="font-weight: bold;">&lt;= CHANGE THIS LINE TO =&gt;</span> var itemProps = 'white-space:nowrap;';<br />&nbsp;&nbsp;&nbsp;&nbsp;if( menu.fontFamily != '' ) itemProps += 'font-family:' + menu.fontFmaily+';';<br />&nbsp;&nbsp;&nbsp;&nbsp; .... some code here .... <br />}<br /></blockquote><br />You should find this spot around line 163 of mm_menu.js. The change worked a charm. Thanks Hiroto!<br /><br />]]></description>
				<category>HTML/CSS</category>
				<pubDate>Fri, 16 Feb 2007 13:15:00 GMT</pubDate>
			</item>
		
			
			
			
			
			
			
			
			

			
				
			
			<item>
				<title><![CDATA[Calling All Developers]]></title>
				<author>Jay Goldman &lt;info@radiantcore.com&gt;</author>
				<link>http://www.radiantcore.com/blog/archives/08/12/2006/dev06hiring</link>
				<guid isPermaLink="true">http://www.radiantcore.com/blog/archives/08/12/2006/dev06hiring</guid>
				<comments>http://www.radiantcore.com/blog/archives/08/12/2006/dev06hiring#comments</comments>
				<description><![CDATA[December brings a lot of things riding on its cold, wintery, wind: snow to our part of the world, the Holiday season, joy, carols, presents, and, of course, hiring season.<br /><br />That's right folks! It's that hiring time of year at the Radiant Ranch. In addition to our previously mentioned <a href="http://www.radiantcore.com/careers/dsn10">Senior Designer</a> opening, we've just posted a <a href="http://www.radiantcore.com/careers/dev06">new opportunity for an Intermediate to Senior Java Developer</a> to join our Professional Services team. If you're the kind of person who likes wrestling with nasty bugs, ropin' specifications, and chowin' down on databases, you're just our type. Head on over to the job description for some details and wrassle up a resume to send in!<br />]]></description>
				<category>Taking Care of Business</category>
				<pubDate>Fri, 08 Dec 2006 16:43:00 GMT</pubDate>
			</item>
		
	</channel>
</rss>