weather 0.9

Last week I saw a contest on yr.no. Create an application that uses their weather data. They gave away prices for 3 categories; web, desktop and mobile. I had a long time considered making a weather php lib so I decided to join.

First I created a general weather php lib that gathered the weather information from yr.no. Then I had to decide what application I wanted to make. I actually decided to make multiple small applications. One netvibes UWA widget, a facebook application and wordpress widget. I knew I had little time and the other competitors had 5 week head start on me but I wanted at least try.

I started on the UWA widget… and actually never got any time to start on the other applications. It was fun to work with UWA but it have some severe restrictions. To list a few.

  • Not allowed with external css and js files. This was a major problem since I decided to use Google Maps to get the longitude and latitude needed of the weather api I had decided to use.
  • According to netvibes it is not possible to create a auto completion text box in their preferences. Still think there should be possible to find a way to do it… but haven’t found one yet. If this was allowed I could have used it as way to select location instead of Google Maps. I really didn’t want to use the old fashioned post to get the location, it is just to boring!
  • Since you can’t load external js file I was advised to use my Google Maps in an iframe. This would solcethe problem. The only problem was to send the values back from the iframe to the preferences. Since a UWA widget is automatically part of the netvibes.com domain but the iframe is on my domain. There is security restriction that won’t let you access the parent elements functions. This was a major hassle! Thanks to this article I found a solution using javascript and hashes. It work excellent in browsers like Firefox but there are some issues in browsers like IE7. You actually have to change the security settings in IE7 to make it work. And if that wasn’t enough it will not work at all on some browsers if my widget is inside another iframe and thats how netvibes.com add you widget to their page. So on some browsers it works fine in stand alone mode but you have to set the longitude and latitude manually on other browsers.
  • The applications in UWA is supposed to automatically work on lots of other platforms like iGoggle, Windows Vista Gadget, Opera Widget, Yahoo Widgets, Mac and more. I have only tried it on iGoogle so far and it doesn’t work and I can’t see I get any error messages. A bit annoying but haven’t really had the time to debug and figure out what is wrong. I’m guessing since I have problems with iGoogle that is supposed to be one of the easier ones it will probably not work on the others either. I will have to try that some other day!

So these problems took way too much time and is the reason why I didn’t manage to create more application. Since I didn’t even manage to make the UWA widget work perfect in all browsers I don’t think I have any chance of winning. Not that my idea was that creative. Probably someone else that have created something better and more creative since they had 6 times as much time ;-) But it was fun to finally try and create an UWA application.

Take a look at my weather page on http://weather.larsolavtorvik.com/. Not the prettiest page but at least I have some more information there, including a download for the whole source code fort he project.

4 Responses to “weather 0.9”

  1. Michael Mahemoff Says:

    Hi Lars,

    I’m glad the cross-domain article was useful, but it’s disappointing to hear it failed on IE7. Do you recall which security settings it failed on? I wonder if there’s a workaround …

    BTW another possible issue here is google maps unfortunately requires a different API key for each document it runs in. If it runs in the main widget, it will only work on one widget platform (unless you try to do some cleverness like detecting the container). This could be another reason to hold it in an iframe, where it is always sitting in the same domain.

  2. Lars Olav Torvik Says:

    Hi Michael.
    Thanks a lot for the article. It helped me at least find a solution. Not perfect but much better then having to abandon the whole idea! :-)

    The problem with IE7 is that it default have a security setting that is called “Navigate sub-frames across different domains”. That is disabled by default and you need to enable it for this way to work. And as I said it will still not work when the whole widget is in an iframe not even when you change the security setting in IE7. If anyone have any ideas to fix the problem feel free to tell me.

    Yeah you are correct. It also was a problem that I actually have to register the domain I want to run Google Maps in. I just forgot to mention it.

  3. Bendik Says:

    Hi Lars,

    It was fun to see that others also had chosen to make a UWA widget for this contest. I think you had a great idea to use the Google maps to solve the problem of finding places. But I am sorry to say that I am not surprised over your cross-domain problem. It has killed some widgets ideas I have had before (SMS from tlf.no).
    I used geonames to find the places, although I don’t think it is a perfect solution. I hope Yr will make a place search API.
    As for the widget to work on other platforms I can agree on that it is hard if not impossible to get it to work 100% on all platforms.

    Good luck in the competition.

  4. Lars Olav Torvik Says:

    Yeah UWA widget is a natural choice since you are able to create for many different system at the same time. It was anoying that I didn’t manage to make a perfect solution. So as I said don’t think I have much chance in the competetition. I just got too litle time to get a solution working on everything. I was concidering removing the whole Google Maps and do a simpler solution. But it is the Google Maps integration that is cool, I have never seen any similar solution :-)

    More then 70% of my visitors use FireFox. I wish that was reprecentative for the rest of the world too… not only the developers that visit this site! Becouse on FireFox the widget is great hehe.

    Oh well doesn’t really matter I already have a ultra portable laptop… but I still don’t like to loose :-)

    Good luck with the competition Bendik. Seems you have choosen a more versitile soltution that works fine, so you might have a shot. Would have been interesting to know how many have entered the competition.

Leave a Reply