[Tut] OS Detection in JQuery

2 posts Page 1 of 1
Contributors
User avatar
mikethedj4
VIP - Site Partner
VIP - Site Partner
Posts: 2592
Joined: Thu Mar 25, 2010 4:36 am

[Tut] OS Detection in JQuery
mikethedj4
All you really need to know is that js/jquery-1.3.2.js adds in JQuery to your html page, and that js/jquery.client.js has the codes inside it to detect your OS, as well as your web browser.

These are the codes that belong in your index.html file.
Code: Select all
<html>
<body>
<div id="os"></div>
<script src="js/jquery-1.3.2.js"></script> 
<script src="js/jquery.client.js"></script>
<script>
	$('#os').html("<strong>Operating System</strong>: " + $.client.os + "");
</script>
</body>
</html>
There is also navigator.platform.
Code: Select all
document.body.innerHTML = "<strong>OS:</strong> " + navigator.platform;
Last edited by mikethedj4 on Sat Oct 03, 2015 11:26 pm, edited 2 times in total.
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: OS Detection in JQuery
mandai
You can also get the operating system from the navigator.platform and navigator.appVersion objects.
2 posts Page 1 of 1
Return to “Tutorials”