可以在一个按钮上实现:button按钮的文字在 全屏 / 退出全屏 之间切换,以下为FR10.0已经实现的代码
var docElm = document.documentElement;
var explorer = window.navigator.userAgent.toLowerCase();
var btn = this.options.form.getWidgetByName('button0');
if(explorer.indexOf('chrome')>0){//webkit
if (document.body.scrollHeight === window.screen.height && document.body.scrollWidth === window.screen.width) {
if (document.exitFullscreen) {
document.exitFullscreen();
}
else if (document.msExitFullscreen) {
document.msExitFullscreen();
}
else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
}
else if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
}
btn.setText("全屏");
} else {
//W3C
if(docElm.requestFullscreen){
docElm.requestFullscreen();
}
//FireFox
else if(docElm.mozRequestFullScreen){
docElm.mozRequestFullScreen();
}
//Chrome等
else if(docElm.webkitRequestFullScreen){
docElm.webkitRequestFullScreen();
}
//IE11
else if(elem.msRequestFullscreen){
elem.msRequestFullscreen();
}
btn.setText("退出全屏");
}
}else{//IE 9+ fireFox
if (window.outerHeight === window.screen.height && window.outerWidth === window.screen.width) {
if (document.exitFullscreen) {
document.exitFullscreen();
}
else if (document.msExitFullscreen) {
document.msExitFullscreen();
}
else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
}
else if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
}
btn.setText("全屏");
} else {
//W3C
if(docElm.requestFullscreen){
docElm.requestFullscreen();
}
//FireFox
else if(docElm.mozRequestFullScreen){
docElm.mozRequestFullScreen();
}
//Chrome等
else if(docElm.webkitRequestFullScreen){
docElm.webkitRequestFullScreen();
}
//IE11
else if(elem.msRequestFullscreen){
elem.msRequestFullscreen();
}
btn.setText("退出全屏");
}
}