| author | ymh <ymh.work@gmail.com> |
| Tue, 12 Feb 2013 10:54:34 +0100 | |
| changeset 134 | 678b07d351ef |
| parent 78 | 8c3f0b94d056 |
| permissions | -rw-r--r-- |
|
78
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff
changeset
|
1 |
function IsSmartphone() { |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff
changeset
|
2 |
return DetectUagent("android") || |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff
changeset
|
3 |
DetectUagent("iphone") || |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff
changeset
|
4 |
DetectUagent("ipod") || |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff
changeset
|
5 |
DetectUagent("symbian") || |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff
changeset
|
6 |
DetectUagent("series60") || |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff
changeset
|
7 |
DetectUagent("windows phone") || |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff
changeset
|
8 |
(DetectUagent("windows nt") && DetectUagent("arm")) || // Windows 8 on phone and surface! |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff
changeset
|
9 |
DetectUagent("blackberry"); |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff
changeset
|
10 |
} |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff
changeset
|
11 |
|
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff
changeset
|
12 |
function IsIpad() { |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff
changeset
|
13 |
return DetectUagent("ipad"); |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff
changeset
|
14 |
} |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff
changeset
|
15 |
|
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff
changeset
|
16 |
function DetectUagent(name){ |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff
changeset
|
17 |
return (navigator.userAgent.toLowerCase().search(name) > -1); |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff
changeset
|
18 |
} |