Is there a reliable way to detect that a web-page is being viewed from an iPad (no false positives) and what the orientation is via JavaScript?
I think this is good for the first part:
var isiPad = navigator.userAgent.match(/iPad/i) != null;
I think I have found the second part:
<button onclick="detectIPadOrientation();">What's my Orientation?</button>
<script type="text/javascript">
    window.onorientationchange = detectIPadOrientation;
    function detectIPadOrientation () {
        if ( orientation == 0 ) {
            alert ('Portrait Mode, Home Button bottom');
        } else if ( orientation == 90 ) {
            alert ('Landscape Mode, Home Button right');
        } else if ( orientation == -90 ) {
            alert ('Landscape Mode, Home Button left');
        } else if ( orientation == 180 ) {
            alert ('Portrait Mode, Home Button top');
        }
    }
</script>
I don't know if it reliable for all iPads, including the new smaller one for example. So my question is: Would these functions work reliably on all iPads? And would there be any false positives?
 
     
    