How to identify your browser's JavaScript engine

高洛峰
Release: 2016-11-28 13:24:12
Original
1197 people have browsed it

Available for both PC browsers and mobile browsers.

The principle is this js:

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); } };
Copy after login

First detect the WebKit-specific attribute devicePixelRatio, and then detect the implementation of the v8-specific javaEnabled function.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!