jeudi 3 mars 2016

How to write if not (Jquery)

You can detect if the visitor uses a mobile device:

if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Kindle|Silk|Opera Mini/i.test(navigator.userAgent)) {
                // here my codes }

But how to turn this code into an if not (to get all devices that are not these ones)?

Maybe something like this?

if !(/Android|webOS|iPhone|iPad|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Kindle|Silk|Opera Mini/i.test(navigator.userAgent)) {
                // here my codes }

As you understand my question goes about standard syntax (I am learning).

Aucun commentaire:

Enregistrer un commentaire