Skip to content

lukemoreira/vue3-browser-detect-plugin

 
 

Repository files navigation

A fork from Vue Browser Detect Plugin (https://github.com/ICJIA/vue-browser-detect-plugin)

with a small adjustment to work with vue3

License: MIT

Simple plugin for Vue that detects browser name, version, and user-agent.

Installation

npm install vue-browser-detect-plugin

In your main.js:

import browserDetect from "vue-browser-detect-plugin";
Vue.use(browserDetect);
or app.use(browserDetect).mount('#app')

## depending on how you've set up your app

Usage

Browser info:

  • vm.$browserDetect.isIE boolean

  • vm.$browserDetect.isChrome boolean

    • Note: This is Chrome desktop.
  • vm.$browserDetect.isFirefox boolean

  • vm.$browserDetect.isOpera boolean

  • vm.$browserDetect.isSafari boolean

  • vm.$browserDetect.isEdge boolean

  • vm.$browserDetect.isChromeIOS boolean

  • vm.$browserDetect.isIOS boolean

Additional meta info:

  • vm.$browserDetect.meta.name Chrome, IE, Edge, etc.

  • vm.$browserDetect.meta.version Version

  • vm.$browserDetect.meta.ua user-agent

Demo

https://vue-browser-detect.netlify.com/

Nuxt.js

Add vue-browser-detect-plugin/nuxt to the buildModules section of nuxt.config.js

export default {
  buildModules: [
    'vue-browser-detect-plugin/nuxt'
  ]
}

⚠️ If you are using Nuxt < v2.9 you have to install the module as a dependency (No --dev or --save-dev flags) and use modules section in nuxt.config.js instead of buildModules.

CHANGLOG

See CHANGELOG.md

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 90.7%
  • HTML 9.3%