How to check if browser works on MAC?

As described in the title.

I need to find out if the machine is accessing my MAC page or something else

+3
source share
4 answers

You can check userAgent as follows:

return navigator.userAgent.indexOf(\"Mac OS X\") != -1

But this is not a reliable method, because it can be faked ... but since there is no absolute javascript value for this, this is not a terrible option. The detection function is the best alternative if you want to see what the browser will / will not support ... it depends if you, after metrics, actually enable / disable the functions.

+8
source

You can use:

<html>
<body>

<script type="text/javascript">
document.write("Browser CodeName: " + navigator.appCodeName);
document.write("<br /><br />");
document.write("Browser Name: " + navigator.appName);
document.write("<br /><br />");
document.write("Browser Version: " + navigator.appVersion);
document.write("<br /><br />");
document.write("Cookies Enabled: " + navigator.cookieEnabled);
document.write("<br /><br />");
document.write("Platform: " + navigator.platform);
document.write("<br /><br />");
document.write("User-agent header: " + navigator.userAgent);
</script>

</body>
</html>

ref: http://www.w3schools.com/js/js_browser.asp

+2
+1
source

Source: https://habr.com/ru/post/1738733/


All Articles