2010-06-22 97 views
6

如何使用flash模擬F11(全屏不能最大化瀏覽器窗口): http://www.broculos.net/files/articles/FullscreenFlash/flashFullscreen.html使用javascript模擬F11

閃光燈

fscommand("fullscreen", true)

permadi.com/tutorial/flash9FullScreen/index.html 

感謝

更新

我發現這一點:

var docElm = document.documentElement; 

if (docElm.requestFullscreen) { 
    docElm.requestFullscreen(); 
} else if (docElm.mozRequestFullScreen) { 
    docElm.mozRequestFullScreen(); 
} else if (docElm.webkitRequestFullScreen) { 
    docElm.webkitRequestFullScreen(); 
} 

/* Exiting the full screen => showing the FULL SCREEN button */ 
if (docElm.requestFullscreen) { 
    document.addEventListener("fullscreenchange", function() { 
     if(!document.fullscreen) { 
      // Do something 
     } 
    }, false); 
} else if (docElm.mozRequestFullScreen) { 
    document.addEventListener("mozfullscreenchange", function() { 
     if(!document.mozFullScreen) { 
      // Do something 
     } 
    }, false); 
} else if (docElm.webkitRequestFullScreen) { 
    document.addEventListener("webkitfullscreenchange", function() { 
     if(!document.webkitIsFullScreen) { 
      // Do something 
     } 
    }, false); 
} 

這僅適用於(從看到搞什麼名堂)只在按鈕點擊。無法在網頁加載時執行此操作

回答

2

這不適用於JavaScript。它被提議用於HTML5視頻API,但後來是scrapped

+0

它沒有被廢棄,它的重要考慮:http://www.mail-archive.com/[email protected]/msg19915.html – mwilcox 2010-06-22 17:40:29

0

有一個非常基本的教程在Mozilla:

請注意,這個帖子的,這是 「實驗技術」。

function requestFullScreen(elt) { 
    console.log("Requesting fullscreen for", elt); 
    if (elt.requestFullscreen) { 
     elt.requestFullscreen(); 
    } else if (elt.msRequestFullscreen) { 
     elt.msRequestFullscreen(); 
    } else if (elt.mozRequestFullScreen) { 
     elt.mozRequestFullScreen(); 
    } else if (elt.webkitRequestFullscreen) { 
     elt.webkitRequestFullscreen(); 
    } else { 
     console.error("Fullscreen not available"); 
    } 
} 

我能夠用div,video和canvas元素成功地測試了這一點。以下是jsfiddle中的代碼 - http://jsfiddle.net/luken/001834wn/ - 但請注意,由於某些原因,它實際上並不在jsfiddle中工作。