Skip to content

Instantly share code, notes, and snippets.

@teramako
Created February 13, 2013 12:53
Show Gist options
  • Save teramako/4944409 to your computer and use it in GitHub Desktop.
Save teramako/4944409 to your computer and use it in GitHub Desktop.
またしても、しょうもないJavaScriptEngine 判定を書いてしまった。
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)";
}
}
@teramako
Copy link
Author

Workerとか使うとダメらしいので、あまり使いものにならない

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment