views:

51

answers:

1

Hi all,

I want to know the version of Javascript that is supported by the WebView in Android 1.6.

Thanks in advance, Parth Mehta

A: 

All modern browsers support JavaScript 1.5 at the least, most supporting 1.6 to 1.8.

That's not quite helpful enough though. To get the exact version, you could test for a single new feature in each version.

How can you do this? Create a test page to test the JavaScript version, and run it on the Android browser.

JavaScript 1.6 has a bunch of new Array functions. 1.7 introduces Iterator objects. JavaScript 1.8 introduces the reduce Array function. So we can test for these:

var jsVersion = 1.5;
if (([]).forEach) jsVersion = 1.6;
if (window.Iterator) jsVersion = 1.7;
if (([]).reduce) jsVersion = 1.8;
Delan Azabani