2016-08-13 6 views
0

フルスクリーンAPIを使用して(レイアウトが異なる)新しいページを開こうとしています。ユーザーが開いているコースリンクをクリックすると、適切なページ/レイアウトがフルスクリーンモードで開きます。フルスクリーンAPIと外部リンク

私はフルスクリーンモードを起動するために、この機能を使用しています:

// Find the right method, call on correct element 
function launchIntoFullscreen(element) { 
    if(element.requestFullscreen) { 
    element.requestFullscreen(); 
    } else if(element.mozRequestFullScreen) { 
    element.mozRequestFullScreen(); 
    } else if(element.webkitRequestFullscreen) { 
    element.webkitRequestFullscreen(); 
    } else if(element.msRequestFullscreen) { 
    element.msRequestFullscreen(); 
    } 
} 

// Launch fullscreen for browsers that support it! 
launchIntoFullscreen(document.documentElement); // the whole page 

問題がある、唯一の同じページを開いて受け入れAPIまたはフルスクリーンモードでの隠し要素。私はこれが予想される動作であることを認識しています。

ユーザーが適切なリンクをクリックすると、フルスクリーンモードで別のページを開く必要があります。

これを可能にする回避策はありますか?

答えて

1

これは私が現在フルスクリーンモードを切り替えるために使用しているものです。

function fullscreen() { 
    var isInFullScreen = (document.fullscreenElement && document.fullscreenElement !== null) || 
     (document.webkitFullscreenElement && document.webkitFullscreenElement !== null) || 
     (document.mozFullScreenElement && document.mozFullScreenElement !== null) || 
     (document.msFullscreenElement && document.msFullscreenElement !== null); 
    if (!isInFullScreen) { 
     if (document.documentElement.requestFullscreen) { 
      document.documentElement.requestFullscreen(); 
     } else if (document.documentElement.mozRequestFullScreen) { 
      document.documentElement.mozRequestFullScreen(); 
     } else if (document.documentElement.webkitRequestFullScreen) { 
      document.documentElement.webkitRequestFullScreen(); 
     } else if (document.documentElement.msRequestFullscreen) { 
      document.documentElement.msRequestFullscreen(); 
     } 
    } else { 
     if (document.exitFullscreen) { 
      document.exitFullscreen(); 
     } else if (document.webkitExitFullscreen) { 
      document.webkitExitFullscreen(); 
     } else if (document.mozCancelFullScreen) { 
      document.mozCancelFullScreen(); 
     } else if (document.msExitFullscreen) { 
      document.msExitFullscreen(); 
     } 
    } 
} 

(あなたが気づいたように)それがブラウザのセキュリティによって制限されているようあなたは、フルスクリーンで新しいページを起動することはできません。ただし、.NETまたはJavaアプリケーションのフルスクリーンを開くことはできます。

ブラウザのセキュリティを迂回しようとするひとつの提案は、ユーザーのデスクトップに機能を拡張したページで動作するプラグインを提供することです。

低レベルのイベントフッキングを試したり、それらをシミュレートしようとすることもできます(ハードウェアイベントを「クリック」するなど)。これは、Flash、Javaまたは.NETのような必要に応じて、別の言語で支援することができます。

歯車が回転して問題を回避するのに十分な情報です。なぜこれがブラウザのセキュリティの一部なのかを理解できると確信していますが、拡張性を使用してバイパスする可能性もあります。彼らが本当にブラウザを安全にしたいのであれば、自動ダウンロードやオートランを実行するオプションはなく、javascriptはUIブロックダイアログボックスやオーディオ再生などで迷惑メールを拾うことはできません。 。しかし、私は逃げる。 「ブラウザのセキュリティ」を装ってこの機能を使用することの欠如は、そこにたくさんの厄介な問題があることを考えると、非常に弱い議論です。