More Bug Squashing

Now that I was paying more attention to the Web site, I decided to make the alerts page more dynamic in order to address another nagging issue.  If an NWS alert went into effect or expired while a user had the page open, the alert would display or clear itself dynamically on the banner at the top of the page.  All of my pages have this capability.  The issue is that the alert details displayed below on the weather advisories page do not update dynamically to match the banner.  Also, the weather discussion and weather outlook were static and didn’t update over time if the page was left open.  So I set out to make the entire page update dynamically.  Using Knockout made short work of that item.  I just needed to build server side pages to retrieve and return the data in JSON format.  On the client side I modified the page to periodically retrieve the alerts, details, and discussion information and update the display.  I got that working well and decided I should confirm that everything was working in other browsers.

Firefox and Chrome worked fine.  Then I tried IE11.  Not only did this page not display correctly, but none of my other pages were updating either.  This puzzled me because I was sure it was working previously.  I must not have ever tested with IE11.  So now it was time for some frantic debugging to take place.  I eventually narrowed it down to a custom event I was using that wasn’t firing when the data was retrieved.  This was the event that caused the page to display any updated data.  If I refreshed the page the event would fire correctly.  It only happened on the initial load of the page.  So none of my dynamic pages were updating dynamically in IE11.  Not good.

After I pondered this for a while I wondered why I was using an event in the first place.  I’m pretty sure it had to do with the fact that there were different schedules for retrieving the different types of data, and the different functions that got called to refresh the page.  At one point in the past I had consolidated all of those functions, so now i had the ability to just call it directly without triggering an event.  I made that change and all the pages worked in all the browsers I tested.  Success!

During this process I also decided to update the versions of Minify, jQuery, and Knockout I was using to the latest versions.  I didn’t really see a difference from that change, but I hadn’t updated them for a long time so it was overdue.  I also took the opportunity to add a bit more error checking and console logging to my JavaScript code.  That should help debugging in the future.I also added a local alerts page that displays alerts created by our local county.  I ended up moving the Government status updates off of the traffic page and adding it to the local alerts page as well.

I still haven’t updated the source code zip file on the software Web page.  Hopefully that will come soon.  I also haven’t put my new and more dynamic weather advisories page into production yet.  Testing has been fine so far, but i may want to tweak a few things before I release it.