# Operating System Detection

## Objective of this OS detection code

The objective of this code is to detect the Operating System of the device.

### Lists of supported OS

| OS      | OS Platform                                                                |
| ------- | -------------------------------------------------------------------------- |
| Windows | <ol><li>Win32</li><li>Win64</li><li>Windows</li><li>WinCE</li></ol>        |
| MacOS   | <ol><li>Macintosh</li><li>MacIntel</li><li>MacPPC</li><li>Mac68K</li></ol> |
| iOS     | <ol><li>iPhone</li><li>iPad</li><li>iPod</li></ol>                         |

### Sample Code

{% code title="getOS Code" %}

```
function getOS() {
	var userAgent = window.navigator.userAgent, platform = window.navigator.platform, macosPlatforms = [
			'Macintosh', 'MacIntel', 'MacPPC', 'Mac68K' ], windowsPlatforms = [
			'Win32', 'Win64', 'Windows', 'WinCE' ], iosPlatforms = [
			'iPhone', 'iPad', 'iPod' ], os = null;

	if (macosPlatforms.indexOf(platform) !== -1) {
		os = 'Mac OS';
	} else if (iosPlatforms.indexOf(platform) !== -1) {
		os = 'iOS';
	} else if (windowsPlatforms.indexOf(platform) !== -1) {
		os = 'Windows';
	} else if (/Android/.test(userAgent)) {
		os = 'Android';
	} else if (!os && /Linux/.test(platform)) {
		os = 'Linux';
	}

	return os;
}
```

{% endcode %}

### Sample Code File

{% file src="/files/jb9EW6hEqsD86dLEVOaa" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://api-old.innov8tif.com/other/okayid-web-camera/operating-system-detection.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
