-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathCapabilitiesDetectionExample01.htm
37 lines (30 loc) �� 1.29 KB
/
CapabilitiesDetectionExample01.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<!DOCTYPE html>
<html>
<head>
<title>Capabilities Detection Example</title>
<script type="text/javascript">
//need to wait until onload so body is available
window.onload = function(){
function getWindowWidth(){
if (window.innerWidth){
return window.innerWidth;
} else if (document.documentElement.clientWidth){
return document.documentElement.clientWidth;
} else if (document.body.clientWidth){
return document.body.clientWidth;
}
}
//determine if the browser has Netscape-style plugins
var hasNSPlugins = !!(navigator.plugins && navigator.plugins.length);
//determine if the browser has basic DOM Level 1 capabilities
var hasDOM1 = !!(document.getElementById && document.createElement &&
document.getElementsByTagName);
alert("Window width: " + getWindowWidth());
alert("Supports Netscape plugins? " + hasNSPlugins);
alert("Supports Core DOM 1? " + hasDOM1);
}
</script>
</head>
<body>
</body>
</html>