Files
reference/source/_posts/note/javascript/dom/detect-macos-browser.md
T
2022-11-16 14:10:09 +08:00

373 B

title, tags, layout
title tags layout
How to detect macos browser in JavaScript
JavaScript
one-line
js
DOM
note

In this Article we will go through how to detect macos browser only using single line of code in JavaScript.

Let's define this short function:

const isMacBrowser = /Mac|iPod|iPhone|iPad/.test(navigator.platform);