Weather Display Live for the iPhone and Android

Yes, that is a feature, not a bug. Really.

One of the drives for me to create this application is to develop my javascript skills, and to make sure no server side scripting is required. Not even cookies.
The early versions of iWDL only had settings in iwdl_settings.js; later on I added a settings screen in the application. The settings should persist across sessions, and HTML5 has a feature for that: HTML5 databases. Safari supports this.

So, how does it work?
When a new user visits iWDL on a particular site, say runarweb.com, it does not have settings for this site in the HTML5 database. The settings of iwdl_settings.js will be used. If the user does not change any setting, the database will stay empty. So, if you have an english and a norwegian site with its own settings, switching between iwdl and iwdl_e wil indeed change language because the HTML5 database for iwdl is empty.

Now, the user changes the language to Dutch. Clearly, the user has a preference for that. The setting will be true for the whole site runarweb.com (that is the way I implementated it). So, even when switching from iwdl to iwdl_e, the language will stay Dutch, because it overrules the default setting. That is what the user wanted. The same is true for all other settings.

You can throw away the HTML5 database on your iPhone. Go to Settings ā†’ Safari ā†’ Databases; find www.runarweb.com, database iwdl. In the toolbar, tap Change, now you can delete the iwdl database.

Firefox does not support HTML5 databases, so in my javascript code, I ignore this database stuff. That also means that settings are not preserved between sessions. If I select Dutch using Firefox, and I restart firefox, the language will be back to whatever the default is in iwdl_settings.js.

I just love using new techniques :wink:

Sietse