This is a migrated thread and some comments may be shown as answers.

Detect device

1 Answer 94 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Henry
Top achievements
Rank 1
Henry asked on 31 Oct 2013, 08:43 AM
Hi Experts,

From client code, is it possible to check if my web page containing radcontrols are viewed in a handheld device such as IPAD, smartphones? If its a handheld device, I want to show the user a page optimized for mobile view.

Thanks
Henry

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 31 Oct 2013, 09:15 AM
Hi Henry,

It is possible by checking the user agent. You can try the following client side code which works fine.

JavaScript:
<script type="text/javascript">
    function pageLoad() {
        if ($telerik.isMobileSafari) {
            //Page Viewed in iPhone OS Mobile Safari
        }
        else if ($telerik.isTouchDevice) {
            //Page viewed in a  device that supports touch capabilities such as IPAD, tablets, other smartphones.
        }
        else {
            //Your Code.
        }
    }
</script>

Thanks,
Princy.
Tags
General Discussions
Asked by
Henry
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or