How to make CSS visible only for Android phone UC browser
1 answer
Take a look at this article: CSS: User Agent Selector
Basically when you use this script:
var b = document.documentElement;
b.setAttribute('data-useragent', navigator.userAgent);
b.setAttribute('data-platform', navigator.platform );
b.className += ((!!('ontouchstart' in window) || !!('onmsgesturechange' in window))?' touch':'');
You can now use CSS to target any browser / version.
So for Android UC I looked here to see the Android UC user agent strings and they all contained the text 'UCBrowser' so we can do the following:
html[data-useragent*='UCBrowser'] .someRules
{
visibility: visible;/* or display:block etc */
}
+1
source to share