Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can Google Docs go fullscreen in JavaScript

How can Google Docs go fullscreen in JavaScript?
In a Google Docs Presentation, when you press the fullscreen button at the lower left corner of the window, the window goes fullscreen.
It is not Flash so I am curious that how can Google do that?

Added

Note that it is not creating a big window that fits the screen (that's fake fullscreen). It is actually in fullscreen mode, and Google Chrome asked for my permission.

like image 571
Derek 朕會功夫 Avatar asked Oct 20 '11 23:10

Derek 朕會功夫


2 Answers

It seems they are using the technique described in this article: http://www.thecssninja.com/javascript/fullscreen

// Mozilla
element.mozRequestFullScreen();

// Webkit
element.webkitRequestFullscreen();

Edit: That article forgets to mention that if you want the whole page fullsreen you can do document.body.webkitRequestFullscreen();.

like image 84
Lycha Avatar answered Nov 04 '22 21:11

Lycha


I've tested the code given in this question on Internet Explorer 9:

How to make browser full screen using F11 key event through JavaScript

At least for Internet Explorer 9, though, the permission dialog might be misleading.

like image 26
Peter O. Avatar answered Nov 04 '22 21:11

Peter O.