お手軽 レンダリングエンジンバージョン判定
getRenderEngineVersion() は、レンダリングエンジンのバージョン番号(Major[.Minor])を返します。
<html><head><title></title></head><body> <script> function getRenderEngineVersion() { // @return Number: var rex = /(?:rv\:|Kit\/|sto\/)(\d+\.\d+(\.\d+)?)/; return parseFloat(((rex.exec(navigator.userAgent) || [,0])[1]).toString(). replace(/[^\d\.]/g, ""). replace(/^(\d+\.\d+)(\.(\d+))?$/, "$1$3")); } window.onload = function() { alert(getRenderEngineVersion()); } </script> </body></html>
Browser | Result value | Engine |
Google Chrome3.0.182.3 | 531 | WebKit |
Safari4β | 528.16 | WebKit |
Safari4 | 530.17 | WebKit |
Firefox2.0.0.20 | 1.81 | Gecko |
Firefox3.0.10 | 1.9 | Gecko |
Firefox3.5β4 | 1.91 | Gecko |
IE8(IE7モード) | 0 | Trident |
IE8(IE8モード) | 0 | Trident |
Opera9.27 | 0 | Presto |
Opera9.52 | 0 | Presto |
Opera9.61 | 2.11 | Presto |
Opera10β | 2.215 | Presto |