Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- NOTE: RequestFullScreen needs to be bind to a user action (for security reasons)
- //OLDER iron/chrome : document.documentElement.webkitRequestFullScreen()
- var elem = document.documentElement;
- if (elem.webkitRequestFullScreen) {
- elem.webkitRequestFullScreen();
- } else if (elem.mozRequestFullScreen) {
- elem.mozRequestFullScreen();
- } else if (elem.requestFullScreen) {
- elem.requestFullScreen();
- }
- //Newer chrome : document.documentElement.requestFullscreen();
- <script>
- /* Get the documentElement (<html>) to display the page in fullscreen */
- var elem = document.documentElement;
- /* View in fullscreen */
- function openFullscreen() {
- if (elem.requestFullscreen) {
- elem.requestFullscreen();
- } else if (elem.webkitRequestFullscreen) { /* Safari */
- elem.webkitRequestFullscreen();
- } else if (elem.msRequestFullscreen) { /* IE11 */
- elem.msRequestFullscreen();
- }
- }
- /* Close fullscreen */
- function closeFullscreen() {
- if (document.exitFullscreen) {
- document.exitFullscreen();
- } else if (document.webkitExitFullscreen) { /* Safari */
- document.webkitExitFullscreen();
- } else if (document.msExitFullscreen) { /* IE11 */
- document.msExitFullscreen();
- }
- }
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement