1. How do I get started with writing Gadgets?
[Up]
2. What APIs are available?
[Up]
The API reference for Windows Live Gadgets can be found
here.
Please note that we are still in Beta, and the APIs are subject to change. Our current
plans for a final release is in late fall of 2006. We currently make no guarantees
that these APIs will be stable. In fact, we already know of several upcoming changes.
When those APIs become available, they will be made available through the same API
reference document above.
3. How do I test my Gadget?
[Up]
You can test your Gadget locally on your own web server. For details on how to do
this, refer to the
Testing & Debugging
section of the Windows Live Gadget Developer's Guide.
4. How do I consume a web service in my Gadget?
[Up]
There is an example of how a Gadget calls a web service in the Web.Network.createRequest
API reference. Please refer to that
documentation.
5. How do I store user preferences in my Gadget?
[Up]
Use the
setPreference,
getPreference and
deletePreference
APIs to manage user preferences within your Gadget. You can use user preferences
to store things like stock tickers in a stock quote Gadget, cities in a weather
Gadget, or any other data that you need to persist on a per user basis. For more
information about them, please see the
API reference document.
6. How do I tell what the current locale is in my Gadget?
[Up]
You can tell what the current user locale is based on the M_CultureVariable_Text
variable. However, this will be deprecated shortly. You can alternatively use
module.getLocale().
7. How do I talk to other Gadgets on the same page?
[Up]
This is not currently supported for 3rd party Gadgets, because your Gadget is sandboxed
in its own IFRAME.
8. How do I get the width of the <div> element that my
Gadget lives in?
[Up]
You can get the width of the <div> element that your Gadget lives in by doing
the following:
var bodyEl = module.getBodyEl();
alert(bodyEl.offsetWidth);
However, you shouldn't need to know the exact width of your Gadget and manually adjust your Gadget content. Whenever you change the contents of your Gadget that may affect its layout, just call
module.Resize().
9. How do I enable my Gadget to access services that require
Passport authentication?
[Up]
This is not currently supported for 3rd party Gadgets, because your Gadget is sandboxed
in its own IFRAME.
10. How do I localize my Gadget?
[Up]
You can use a switch statement on the return value from module.getLocale(),
and display different strings depending on locale. We may have better support
for localization in the future.
11. How do I properly scope the CSS for my Gadget?
[Up]
CSS declarations must be scoped to the gadget's namespace in order to prevent collisions with other elements on the page. The gadget container will automatically be given a
classname which corresponds to the gadget's binding namespace. So, for example, if the gadget binding is "Microsoft.Live.GadgetSDK.NotepadGadget", the gadget container would have
className "Microsoft_Live_GadgetSDK_NotepadGadget" ("." is replaced with "_"). CSS declarations can then be scoped as such:
.Microsoft_Live_GadgetSDK_NotepadGadget .TextArea
{
color:black;
}
12. How do I load my gadget from localhost for IE7?
[Up]
Problem: Unable to load a gadget with localhost in the manifest URL.
Solution: Set "Access data sources across domains" to "Prompt" specifically for the trusted sites zone (as opposed to Internet zone, which the docs specify). You may want to set your
Internet zone setting back to "Disabled".