时间:2021-07-01 10:21:17 帮助过:2人阅读
window.onload = function() {
var v8string = 'function%20javaEnabled%28%29%20%7B%20%5Bnative%20code%5D%20%7D';
if (window.devicePixelRatio) //If WebKit browser
{
if (escape(navigator.javaEnabled.toString()) === v8string)
{
display('V8 detected');
}
else
{
display('JSC detected');
}
}
else {
display("Not a WebKit browser");
}
function display(msg) {
var p = document.createElement('p');
p.innerHTML = msg;
document.body.appendChild(p);
}
};
首先检测WebKit特有的属性devicePixelRatio,然后检测v8特有的javaEnabled函数的实现。