The answer comes from StackOverflow. Just open this webpage http://jsbin.com/opuvas. This webpage is also written by the respondent himself.
The QR code is this URL. There are statistics on the number of visits to the webpage. The author wants to know how many people it is useful to. It is recommended to respect the originality and not copy this webpage.
Available for both PC browsers and mobile browsers.
The principle is this js:
window.onload = function() {
var v8string = 'function javaEnabled() { [native code] }';
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);
}
};
First detect the WebKit-specific attribute devicePixelRatio, and then detect the implementation of the v8-specific javaEnabled function.