when coding for mobile devices, you'd have to take into account each possible result..
I'm a bit rough on coding, but for what you posted it seems like it would check whether it's an iPad or not and in this case return a null (since it's a droid). What you DO with the result, is up to you..
There are some other options listed in the link below.
http://www.hand-interactive.com/resources/detect-mobile-javascript.htm