With Spidermonkey --> ActionMonkey/TraceMonkey, JSCore --> Squirrelfish, IE's... improved engine (still fundamentally the same?), and whatever Opera is using (it's hard to find anything specific about it), I was wondering if anybody knows of a nice way of detecting what engine (and what version) is being used. The user-agent generally gives build ids and the verion of whatever rendering engine, but nothing (directly) about the js engine. I could always make a guess at what JS engine is being used from the user-agent, but that is less than ideal.
You probably need to call a number of functions which are vendor specific in order to establish browser type. for example document.all is not supported by all browsers
09-04-2008, 12:47 AM
ess: And document.all has nothing at all to do with the scripting engine.
Opera: It's easy for the moment: Versions < 9.50 use linear_b, versions >= 9.50 use futhark. I bet they have getting yet another engine into version 10 or 10.5 as a high priority item to meet the newly arisen competitive pressure from V8, SquirrelFish and TraceMonkey, so I would not assume futhark is staying for long unless they can gradually improve it along the way SpiderMonkey-->TraceMonkey did.
Microsoft: The data on script engine version is available in the ScriptEngine (http://msdn.microsoft.com/en-us/library/efy5bay1(VS.85).aspx) object. Be aware however that there are multiple different versions of both JScript 5.6 and JScript5.7. In other words, JScript 5.6 can be installed on ie<6, and for JScript5.7 there are actually two entirely separate versions of JScript with that version number, one for ie7 and one for ie<7, and the one bundled with ie7 contains many more improvements than the one for ie<7. JScript5.8 seems confined to ie8 so far, though.
Google: Well, if it's Chrome it's using V8.
In short: You need to use browser version sniffing to know, for those where it's at all possible to know. And Microsoft gives you the information, but is treacherous in that the same version doesn't mean the same thing in different browsers. And the Pink Invisible Unicorn be with you if you ever encounter fringe browsers!
As always, good information. Thanks!
09-09-2008, 11:38 PM