26/10/2011

Weather in iGoogle

I've been using iGoogle for a while now. For those not in the know, this personalises the Google homepage and allows you to add "gadgets". Since I've started using Chrome as my browser I tend to Google search from the address bar anyway, but I still find iGoogle pretty handy.

I use it as a way to amass all the stuff I tend to look at in one session. Currently I have three different tabs:

  • News - Local and world affairs and specific technology news
  • Comics - Webcomics that I like to read
  • Weather - Local weather forecasts so I know if I need a coat
These are all areas that I tend to want to update myself on regularly - approximately once a day. So instead of trawling through various bookmarked pages I can accumulate all the info in one convenient page.

This works out really well and I've found there are specific gadgets for most of the pages the I want to visit. Some of the news related ones didn't have gadgets but I was able to use use their RSS feed to display them in an RSS reader gadget.

The only real pain was the some of the weather forecast sites that I wanted to look at didn't have gadgets - most notably Metcheck.com. I really like the way they display the forecast so I set about trying to get it onto an iGoogle page. The 'official' way to do this I guess would be to make a specific gadget; however this seemed like it would be a lot of effort and learning time. So I went with a different option.

I used a gadget that allows the inclusion of html. Then I wrote some HTML to include a portion of another website. This allowed me to trim the site down to just the specific window I wanted. For example:
<style type="text/css"> #container{ width: 0px; height: 0px;} #container iframe {width: 780px;   height: 590px;   margin: -180px 0px 0px -240px; }   </style> <div id="container"> <iframe scrolling="no" width="0" height="0" src="https://www.netweather.tv/index.cgi?action=uk7dayx7;page=1;ct=19121~Manchester;sess=#forecast></iframe></div>

This includes the portion of netweather.tv for my specific region. I was previously using metcheck but have recently switched as their results page seems to regularly give errors at the moment.

There might be an easier way of doing things, and for other websites the numbers in the HTML will need fiddling with so that the right portion of the page is in the window, but this technique seems to work pretty well for now.