I'm working on a application which works in full screen mode. I'm using a Iframe to go to fullscreen. the problem is how to close that fullscreen on button click?
I'm using this code:
function exitfs(){
if (document.cancelFullScreen) {
document.cancelFullScreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
}
}
It works fine if i run it through firebug console but not works when bind with click event?
function fullscreen(keys) {
var f = e('newIfrane');
if (keys) {
if (f.mozRequestFullScreen) {
f.mozRequestFullScreenWithKeys();
} else if (f.webkitRequestFullScreen) {
f.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
}
} else {
if (f.mozRequestFullScreen) {
f.mozRequestFullScreen();
} else if (f.webkitRequestFullScreen) {
f.webkitRequestFullScreen();
}
}
}
calling this function like fullscreen(false);
Note: Iframe is loading the same page in fullscreen mode. In Page there is a Image on click of that image I'm calling exitfs().
I'm not getting what is the problem? Thanks...
exitfs()in console? You're probably calling it under the context of top window instead of iframe. - Passerby