javascriptjqueryhtmloperaopera-mini

If not Opera Mini


This question is quite simple, but I want to ask it anyway.

This code tell us that user's browser is a famous Opera Mini

var isOperaMini = (navigator.userAgent.indexOf('Opera Mini') > -1);

So I can use it in this way:

if (navigator.userAgent.indexOf('Opera Mini') > -1)
    alert('hey! your browser is buggy');

This is if Opera Mini, then conditional.

How do I make a right short conditional for if not Opera mini, then?

I'm not sure how should I play with -1 integer.


Solution

  • You can simply change it to

    if (navigator.userAgent.indexOf('Opera Mini') == -1)
    

    That will return true if it does NOT find 'Opera Mini' in the user agent string