javascriptxmlwindows-desktop-gadgets

How to access XML data from different source for windows gadgets in Javascript


I have looked at this site before and can't find a response that I'm think will work with a desktop gadget on Windows 7.

Basically, I want to access XML data from weather.gov using Javascript(or anything that will allow me to access it, as long as I can write the rest in javascript) in a desktop gadget environment. The XML url changes based on the location of the user, so I need also to be able to use a dynamic url (Which I only know how to do in JS).

Any help would be appreciated.


Solution

  • To start off, I'd try a normal XMLHttpRequest()

    If that doesn't work, this other stack overflow question has good answers about how to get started developing Windows gadgets. One of the links there should probably help.

    How to get started with Windows 7 gadgets

    [edit] more added

    In your comment, by "SOP" do you mean Same Origin Policy? If so, then maybe gadgets enforce it - seems pretty lame if they do - I have no experience with gadgets, so I don't know.

    Since you don't control the third party server, the usual things I'd mention (JSONP or CORS) don't immediately apply.

    You could create your own web service which reaches out to the third party, but it'd be easier to set up a proxy server. Nginx makes this pretty easy.

    Another option to consider is Yahoo! Pipes. You could create a pipe to read from the weather data and produce something else. Pipes has support for JSONP, which would allow you to circumvent the same origin restriction. In fact, it looks like someone has already done this.

    Hope this helps!