fukuiretu / nuxt-user-agent Goto Github PK
View Code? Open in Web Editor NEWNuxt.js module for handling User-Agent.
Nuxt.js module for handling User-Agent.
Works perfectly on a dev server but when deployed on firebase it always returns chrome.
With Google Chrome's plan to deprecate or freeze the UserAgent string, it will no longer be possible to accurately obtain information such as browser version from the UserAgent string in the future.
There is an alternative method, User-Agent Client Hints, is there any plan to support it?
Hi,
I used Samsung Galaxy Note 10 with the latest Samsung Internet to test the module. This is what user-agent returns by Samsung Internet:
Mozilla/5.0 (Linux; Android 10; SAMSUNG SM-N970F) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/13.0 Chrome/83.0.4103.106 Mobile Safari/537.36
This is what nuxt-user-agent returns:
this.$ua.browser(): 'Chrome'
this.$ua.browserVersion(): '83.0.4103.106'
this.$ua.browserVendor(): 'Google'
Is it possible to detect Samsung Internet and its version? (11.2, 12.0, 13.0, etc.)
Thank you.
Since iOS13 the user-agent for safari iPads changed to be the desktop version, for that reason the plugin doesn't recognizes iPads as tablets anymore.
For information about that can be found here: https://support.google.com/analytics/answer/3223194?hl=en#zippy=%2Cin-this-article
It"ll do some great help to the community for sure 👍
How can we set specific user-agent to get parsed other than current user-agent ?
Hi.
I appreciate your great product :)
When building with the generate command, an error appears.
Cannot read property 'headers' of undefined
To avoid this error, change the reference to ctx.req
as follows.
export default (ctx, inject) => {
let userAgent = "";
if (typeof ctx.req !== "undefined") {
userAgent = ctx.req.headers["user-agent"]
} else if (typeof navigator !== "undefined") {
userAgent = navigator.userAgent
}
ctx.$ua = detector(userAgent);
inject("ua", detector(userAgent));
};
If you make this correction, the command will execute correctly.
Thanks !!
Module works but getting error :
ERROR ERROR in components/HeaderConsole.vue:164:13 11:50:25
TS2339: Property '$ua' does not exist on type 'UseContextReturn'.
162 | },
163 | setup() {
> 164 | const { $ua } = useContext();
Are there any Types setup?
import { defineComponent, ref, useContext } from '@nuxtjs/composition-api';
import { useActions } from 'vuex-composition-helpers';
import ButtonTest from '~/components/ButtonTest.vue';
import useAuth from '~/composables/auth/useAuth';
export default defineComponent({
name: 'HeaderConsole',
components: { ButtonTest },
props: {
user: {
required: true,
},
navigationItems: {
required: false,
type: Array,
},
},
setup() {
const { $ua } = useContext();
I found typo ifFromAndroidOs
and I fixed this, but I could not push my commits.
I have an app that have to ensure the user is on a real mobile device.
By simply changing the user agent on google console dev tools it shows me i'm on mobile.
Is there a way to check and prevent it?
v1.7.0 -> v1.8.1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.