How can I detect which javascript engine (v8 or JSC) is used at runtime in Android?

后端 未结 3 817
小鲜肉
小鲜肉 2020-12-05 15:41

Newer versions of Android ( > 2.2) include the v8 javascript engine, while older versions only had JSC. However, according to http://blogs.nitobi.com/joe/2011/01/14/android

3条回答
  •  不思量自难忘°
    2020-12-05 16:15

    var s = '';
    for (x in {
        3: 3,
        1: 1
      }) {
      s += x
    }
    if (s === '31') {
      alert('JSC');
    } else {
      alert('V8');
    }

    By the way this will categorize Firefox as 'JSC' and newer IE versions will look like V8.

    My blog post has more V8 sniffing tricks: http://erikcorry.blogspot.dk/2012/12/which-version-of-v8-do-i-have.html

提交回复
热议问题