The solution is even easier than that and won't require any conditional statements:
- When clicked from an iOS6 device, links to maps.apple.com/maps?q=cupertino are opened in Apple's native mapping application.
- But on other mobile devices and computers, it redirects to Google Maps (at maps.google.com/maps?q=cupertino) instead.
So at this point, all you need to do is include the Apple Maps link and it should work as expected on non-iOS devices.
I mentioned this in a recent post that also touches on whether the same parameters can be used.