Jasper Jasper - 1 year ago 79
Javascript Question

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

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

I'm not sure how should I play with

Answer Source

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