mirror of
https://github.com/Fechin/reference.git
synced 2026-11-21 05:24:10 +03:00
20 lines
373 B
Markdown
20 lines
373 B
Markdown
---
|
|
title: How to detect macos browser in JavaScript
|
|
tags:
|
|
- JavaScript
|
|
- one-line
|
|
- js
|
|
- DOM
|
|
layout: note
|
|
---
|
|
|
|
|
|
|
|
In this Article we will go through how to detect macos browser only using single line of code in JavaScript.
|
|
<br/>
|
|
<br/>
|
|
Let's define this short function:
|
|
|
|
```js {.wrap}
|
|
const isMacBrowser = /Mac|iPod|iPhone|iPad/.test(navigator.platform);
|
|
``` |