function getViewport(){
var e = window, a = 'inner';
if(!('innerWidth' in e)){
var t = document.documentElement
e = t && t.clientWidth ? t : document.body
a = 'client';
}
return {width: e[a+'Width'], height: e[a+'Height']}
}
Modified slightly from a comment here.
Edit: the code in that comment didn't fully implement the original, and broke when I tried it in IE. So I've updated the code above.
Feel free to post a comment below. Please see my comment policy.
Formatting Rules (No HTML):