1
Good morning, these lines make appear in my user-agent is being used by the client, it helped me with problems in the Trident engine that does not interpret the gradient in the text and works very well.
var useragent = document.documentElement;
useragent.setAttribute('data-useragent', navigator.userAgent);
useragent.setAttribute('data-platform', navigator.platform);
for me to put the style I want according to the user-agent I use in CSS this parameter
html[data-useragent*='Trident'] section#id.class{}
"Trident I can switch to anything else like "Section#id.class{}", what I want now is for him to check if there is NO engine I want, I want to know if there is a 'Mobile' in the user-agent and I tried with
html[data-useragent*!'Mobile']
but it doesn’t work, in case if '=' (has) thought that '!' (has not) would be the opposite but doesn’t work, how could I verify if it doesn’t exist with this criterion? example user-agent with and without Mobile
Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1
Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36
html:not([data-useragent*='Mobile'])
?– Caio Felipe Pereira
@Caiofelipepera boy, exactly, did not know this :not in CSS, never seen anyone using, it worked, thanks, now I no longer need that lot of javascript to detect mobile. Does this method have a name? so I can search more, know what it is and more ways to use.
– flourigh
I’ll assemble a little more complete response then
– Caio Felipe Pereira
@Caiofelipepereira in this case would be pseudo classes http://www.w3schools.com/css/css_pseudo_classes.asp ?
– flourigh