
Security News
New CVE Forecasting Tool Predicts 47,000 Disclosures in 2025
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
nuxt-user-agent
Advanced tools
Nuxt.js module for handling User-Agent.
Inspired by rack-user-agent and, Thanks to woothee :pray:
Install with yarn:
yarn add nuxt-user-agent
Install with npm:
npm install nuxt-user-agent
nuxt.config.js
module.exports = {
modules: [
'nuxt-user-agent',
]
}
asyncData(context) {
const deviceType = context.$ua.deviceType()
return { deviceType }
}
methods: {
something() {
const deviceType = this.$ua.deviceType()
this.deviceType = deviceType
}
}
// In store
{
actions: {
getDeviceType ({ commit }) {
const deviceType = this.$ua.deviceType()
commit('SET_DEVICE_TYPE', deviceType)
}
}
}
<template>
<section>
<div v-if="$ua.isFromPc()">
<span>PC</span>
</div>
<div v-if="$ua.isFromSmartphone()">
<span>Smartphone</span>
</div>
<div v-if="$ua.isFromMobilephone()">
<span>Mobilephone</span>
</div>
<div v-if="$ua.isFromTablet()">
<span>Tablet</span>
</div>
<div v-if="$ua.isFromAppliance()">
<span>Appliance</span>
</div>
<div v-if="$ua.isFromCrawler()">
<span>Crawler</span>
</div>
</section>
</template>
method | type | example |
---|---|---|
deviceType | string | pc |
os | string | Mac OSX |
osVersion | string | 10.12.6 |
browser | string | Chrome |
browserVersion | string | 65.0.3325.181 |
browserVendor | string | |
isFromIphone | boolean | true |
isFromIpad | boolean | true |
isFromIpod | boolean | true |
isFromIos | boolean | true |
isFromAndroidMobile | boolean | true |
isFromAndroidTablet | boolean | true |
isFromAndroidOs | boolean | true |
isFromWindowsPhone | boolean | true |
isFromPc | boolean | true |
isFromSmartphone | boolean | true |
isFromMobilephone | boolean | true |
isFromAppliance | boolean | true |
isFromCrawler | boolean | true |
isFromTablet | boolean | true |
The npm is available as open source under the terms of the MIT License.
FAQs
Nuxt.js module for handling User-Agent.
The npm package nuxt-user-agent receives a total of 5,284 weekly downloads. As such, nuxt-user-agent popularity was classified as popular.
We found that nuxt-user-agent demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.