Simply (and naïve) approach could be:
document.addEventListener('mozfullscreenchange', fullScreenFunction, false)
document.addEventListener('webkitfullscreenchange',fullScreenFunction, false)
document.addEventListener('msfullscreenchange', fullScreenFunction, false)
//etc
function fullScreenFunction()
{
if (util.isLandscape()) {
console.log('EXITED')
}
}
or you could try testing which prefix exists and then only binding one event handle to which one exists.
Rough idea would be something like:
var prefixes = ['webkit', 'moz', 'ms', 'o'];
var prefixToUse = '';
for (var i = 0; i < prefixes.length; i++) {
//This checks against the document object for that event.
//It will start with on eg onmsfullscreenchange or onwebkitfullscreenchange
if( 'on' + prefixes[i] + 'fullscreenchange' in document) {
prefixToUse = prefixes[i];
break;
}
}
document.addEventListener(prefixToUse + 'fullscreenchange', fullScreenFunction, false);
function fullScreenFunction()
{
if (util.isLandscape()) {
console.log('EXITED')
}
}