→、
Document で現在 全画面モードで表示されている要素が全画面モードを向け、画面を以前の状態に戻すことを要求します。これはふつう、以前の Element.requestFullscreen() の呼び出しの効果を取り消します。
Document | Document。 |
---|
ユーザー エージェントが全画面モードから完全に抜けたら解決される Promise です。全画面モードから抜けようとしてエラーが発生したら、Promise の catch() ハンドラーが呼び出されます。
この例ではマウスボタンで中をクリックするたびに、現在の文書が全画面表示になったり戻ったりします。
document.onclick = function (event) { if (document.fullscreenElement) { document.exitFullscreen() .then(() => console.log("Document Exited form Full screen mode")) .catch((err) => console.error(err)) } else { document.documentElement.requestFullscreen() } }
注: もっと完全な例については、 in Element.requestFullscreen()をご覧ください。
W=window.open("../Com/Test.htm", "Test"); //新しいウインドウで「Test.htm」を開き、ウインドウの名前(window.name)を「Test」とする。 Doc=W.document; //開いたウインドウのDocumentを得る。 Doc.body.requestFullscreen(); //¶できなかった。 //setTimeout("Doc.exitFullscreen()", 3000);
document.body.requestFullscreen(); //本文書をフルスクリーンにする。 setTimeout("document.exitFullscreen()", 3000); //3秒後にフルスクリーンを終了させる。