Created
February 13, 2013 12:53
-
-
Save teramako/4944409 to your computer and use it in GitHub Desktop.
またしても、しょうもないJavaScriptEngine 判定を書いてしまった。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getJSengine() { | |
if (typeof __proto__ === "undefined") | |
return "JScript(IE)"; | |
switch (String(__proto__)) { | |
case "[xpconnect wrapped native prototype]": | |
return "SpiderMonkey(Firefox)"; | |
case "[object Object]": | |
switch (__proto__.constructor.name) { | |
case "Object": | |
return "Carakan(Opera)"; | |
case "Window": | |
return "V8(GoogleChrome)"; | |
} | |
break; | |
case "[object DOMWindowPrototype]": | |
return "JavaScriptCore(Safari)"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Workerとか使うとダメらしいので、あまり使いものにならない