1
2
3
4
5
6
7
8
9
10
11
12
13
function getViewport() {
if(document.compatMode == 'BackCompat'){
return {
width: document.body.clientWitdh,
height: document.body.clientHeight
}
} else {
return {
width: document.documentElement.clientWidth,
height: document.documentElement.clientHeight
}
}
}