views:

21

answers:

2

Are there any JavaScript wrapper scripts available that can use HTML5 JavaScript features if they are available (e.g. locaStorage / Web Storage / anything in common between Google Gears and HTML5), falling back to Google Gears if the browser is not capable (e.g. IE6 or IE7)

While it would be ideal that IE7/6 users all move to IE8 (or Chrome, Firefox, Opera), they will still be around for years to come (maybe IE6 will not last as long as IE7, but IE7 lacks any real JavaScript changes).

A: 

While I don't know of such wrappers, one can use the old failsafe:

if(typeof SomeAdvancedFeature=='undefined')alert('Dude, get a real browser!');
Christian Sciberras
+1  A: 

For feature detection I think most here would recommend the excellent Modernizr. Of course you'd still have to write the Gears part yourself, but that really isn't very hard - just a secondary test after Modernizr reporting back that the features you're looking for isn't available, or creating your own test with the addTest() API.

It comes across as a little odd that you're trying to use Gears as a fallback for those HTML5 components - as far as I can tell, Gears penetration is very low, so it can't really be an reliable fallback for those. Although the functionality is similar, the syntax isn't, so you really are going to be writing twice the amount of code for something that's unlikely to be used.

Yi Jiang
Am wanting to see if I can use any of the more advanced features of HTML5, but the problem is, users are on IE7 and not sure when/if they will be upgraded to IE8, if not then Gears rollout may be possible.
Sam