Windows Live Contacts Q and A

The Windows Live Contacts gadget is picking up speed and interest, and we're starting to see some common factors in questions and conversations with web application teams inside Microsoft and out.

Q: The gadget sample code doesn't load on my web page!  All I see is a white box.  What's wrong?

A: Woops!  There was a typo in the doc sample.  Check the sample code HTML you copied from the early docs.  The expression document.getElementById("ContactGadgetSite") should be document.getElementById("ContactsGadgetSite") .  Note the "s" in the middle.  The string has to match the ID of the DIV element defined earlier.  The doc sample has been fixed.

Q: How do I copy channel.htm to my machine?  When I bring it up in the browser, it just shows a blank page!

A: Open the channel.htm as a file in Notepad or VS or other editor instead of opening it in the browser.  File: Open, <dev.live.com/scripts/addressmanager/channel.htm>.  Then File: Save As to save the file to your local drive or web server file share.  You can name the file whatever you want, but be sure you put the full URL path to that file in the last param to the Microsoft.Gadget.ContactSelectorPartner() constructor call.

Channel.htm contains a little script that navigates the current browser window to about:blank when it has finished its work.  This is necessary to reset the trigger for the next channel event / message.

Q: Cool!  I can use this gadget to suck all the contacts out of users who visit my site?

A: No, the web site doesn't have access to the contact data.  The end user is in control of when and what is transferred.  No data transfer occurs without the user's permission.  If the web site requests name and email address of the contacts the user selects, that's all the web site will receive. 

If a web site tells the end user it wants name and email address for the selected contacts, but the user sees in the gadget's verification page that the web site has actually requested a lot of other data fields that are not needed for the current operation, such as mailing address or phone numbers, then the user should be suspicious of the web site and cancel the transfer.

Q: How does the gadget prevent the host web site from seeing/stealing all the user's contact data?

A: The gadget sets up its UI in an iframe element.  The iframe's src URL points into dev.live.com, which is a different domain than the host site.  By the rules of the browser security model, the host page cannot see into an iframe whose URL is a different domain.  That is, JavaScript in the host context cannot walk the DOM of the iframe, cannot access JavaScript variables, and cannot call JavaScript functions defined in the iframe.

So, even though the user can see their contacts on the screen in a box sitting in the host page, the host page cannot see the contacts at all.

Q: The sample apps are dumb.  I already know where my buddies live!

A: The sample apps are just that: samples.  Their primary function is to show how to use the contacts gadget (and the Virtual Earth map control) in a realistic application setting. 

The sample apps are the itty bitty free sample tasting spoons at an ice cream parlor, not the three scoop banana sundae with hot fudge and sprinkles.  Windows Live provides many flavors of ice cream and top dressings.  Your job as a web app author is to build your own signature sundaes using a palette of Windows Live flavors and your own ingredients.  It's a lot easier to create a variety of sundaes when you don't have to make the ice cream yourself!

Instead of focusing on the utility of the sample apps, take a step back and think about the utility of the contacts gadget itself, and of the data management techniques developed for the contacts gadget that can be used by other gadgets shepherding other data for the user.  That's what makes this gadget interesting.

Q: The contacts gadget distributes my personal information without my permission! 

A: No, it doesn't.  You gave your contact information to your buddy, and entrusted them to use your contact information appropriately.  Your buddy has always been able to manually type your contact info into the ship-to form of an online retailer to send you a book.  The online retailer now has your contact info, because your buddy gave it to them.  Or, your buddy can use the contacts gadget on that web store site to send that book to you.  The contacts gadget makes it easier for your buddy to use your contact info, but it does not change the fact that it is your buddy who decides where to use your contact info.

If you don't want to entrust your home mailing address to your buddies, then don't share it with them.  You can specify which of your contacts can see which parts of your personal info in the Windows Live Contacts preferences and settings.

Q: Is it really correct to call it a gadget?  It's different from the Windows Live Gadgets SDK gadgets.

A: Yes and No.  Yes, it's a gadget in the sense that it is a strongly encapsulated relatively small thing that implements a specific function.  An iPod is a gadget.  A cellphone is a gadget.  A bulldozer is not a gadget.

However, it's true that this contacts thingamajig does not fit the narrow Windows Live (recently renamed) Web Gadget SDK definition of 'gadget'.  The contacts thingamajig can be used on any web site, without an special server configuration or environment.  Web Gadgets can only live on web domains running ASP.NET and the Gadget SDK runtime environment - currently, that means live.com and spaces.live.com, and the Vista desktop sidebar.  Web Gadgets are consumer-oriented - just drop it on your spaces homepage and it works.  Setting up the contacts thingamajig requires that you write a little bit of JavaScript - not exactly drag & drop consumer-oriented. 

Debates and discussions rage on internally.  Just keep in mind that this is a beta, where everything including the name are subject to change. 

Meanwhile, if calling it a gadget doesn't seem right to you, feel free to call it a snorkel instead.  Or, on a less formal basis, Fred.

Q: The sample apps don't work with Firefox 2.0 beta 1!

A: This is an issue between the Virtual Earth map used by both sample apps and Firefox 2.0 beta's support for SVG or VML.  The contacts gadget itself works fine in Firefox 2.0 beta (and Firefox 1.5).  The proper authorities have been notified.

Q: The gadget works fine on my page, until the user clicks "submit".  My page doesn't receive the data!  What's wrong?

A: The channel endpoint on your web site/server is misconfigured.  Double check the last param you pass to the Microsoft.Gadget.ContactSelectorPartner() constructor is the full URL to the channel.htm on your server.   If this URL is not in the same domain as your host web page, you won't get any data.  If you haven't copied channel.htm to your server, you won't get any data.  If you pass "channel.htm" that won't work because that's not a full URL.  Relative URLs won't work because the thing sending you the data isn't in your domain / browser context.

Q: So where's that in-depth code walkthrough you promised?

A:  Yeah, yeah.  I'm gettin to it.  I'm working on a blog post that hosts the contacts gadget snorkel right here in the blog, but ran into an issue with the msdn blog server freaking out over script embedded in the post.  I'll show it who's boss, it'll just take a little longer...  hehe  "Vee Haf Vays..."

Q: Where can I ask more questions about the contacts gadget Fred?

A: In the Windows Live Developer forums!  The Windows Live Chatter: Development forum is where most of the contacts discussions are taking place.