Plugin (with TypeScript support) for Vue3 that detects browser name, version, and user-agent. This is a fork of https://github.com/smg99/vue-detect-browser.
npm i vue3-detect-browser
yarn add vue3-detect-browser
In your main.js:
import detectBrowser from "vue-detect-browser";
app.use(detectBrowser);
In any component file it is available as this.detectBrowser
data property
this.detectBrowser.isChrome
this.detectBrowser.isFirefox
this.detectBrowser.isOpera
this.detectBrowser.isSafari
this.detectBrowser.isEdge
this.detectBrowser.isChromeIOS
this.detectBrowser.isIOS
this.detectBrowser.isIE
<script setup>
import { useBrowserDetect } from 'vue3-detect-browser';
const { isFirefox, isChrome } = useBrowserDetect();
</script>