Reputation: 9123
I've already performed media queries for different screen sizes, but I want to have different css if the website is viewed on mobile. So even if the screen is the same min-width
on desktop and mobile, I want to have different css.
Any idea how I can do this?
Upvotes: 0
Views: 711
Reputation: 114
Could use userAgent?
loadUserAgent () {
let UA = navigator.userAgent;
if(UA.match(/Android/) || UA.match(/iPhone/) || UA.match(/BlackBerry/) || UA.match(/iPod/) || UA.match(/Windows Phone/) || UA.match(/iPad/) || UA.match(/webOS/))
{
this.isMobile = true;
}
}
If you want to support other devices such as Blackberry, Opera Mini etc. Your going to have to add their user agents manually.
Upvotes: 2