0

I'm making an HTML5 game.

Is there anyway to provide the user with a button to make it full-screen? For any browsers.

Paul D. Waite
  • 89,393
  • 53
  • 186
  • 261
Harry
  • 47,045
  • 66
  • 163
  • 243
  • 1
    I'm not sure how the "quality standards" quote is relevant here. If your users want to view your HTML5 application in full-screen mode, they only need to press F11 (Windows) or choose the View->Fullscreen option in their browser's menu. – George Cummins Jun 27 '11 at 17:22
  • 1
    May help you out. http://stackoverflow.com/questions/1055214/is-there-a-way-to-make-html5-video-fullscreen – sealz Jun 27 '11 at 17:22
  • You'll get a better response if you reword the question to be more constructive. – Davy8 Jun 27 '11 at 17:22
  • The problem is that flash games have a fullscreen button, but html5 games do that. That makes HTML5 apps second class citizens. – Harry Jun 27 '11 at 17:45
  • But it does seem impossible or else someone would've answered. – Harry Jun 27 '11 at 17:45
  • 1
    “The problem is that flash games have a fullscreen button, but html5 games do that. That makes HTML5 apps second class citizens.” — I think allowing full-screen mode can be a bit of a security issue. Someone could write full-screen content that imitates the website the user is on, and tricks them into entering password details. – Paul D. Waite Jun 27 '11 at 19:29
  • 1
    The browser can add some sort of control, like the desktop notifications permissions dialog. – Harry Jun 28 '11 at 01:34
  • For Safari on a Mac you at least have to wait till Lion and even then there are bars. –  Jun 28 '11 at 11:55

3 Answers3

3

Mozilla, Chrome and Safari now have a Javascript API to make an element full screen.

What one does to make an element full screen, is:

document.getElementById("myvideo").requestFullScreen()

http://www.sitepoint.com/html5-full-screen-api/

3

I think the answer is yes:

Webkit fullscreen api seems like it's coming.

http://peter.sh/2011/01/javascript-full-screen-api-navigation-timing-and-repeating-css-gradients/

Very cool.

Harry
  • 47,045
  • 66
  • 163
  • 243
1

Short answer: no.

Longer answer: WebKit has an experimental implementation of fullscreen, but only for the video element. Mozilla is looking at doing a spec where any element can be made full screen (see also), but no formal spec document has yet been produced, and there are no implementations.

Edit:

Just a note, experimental implementations of the Full Screen API are now available in everything except IE.

robertc
  • 69,665
  • 18
  • 184
  • 170
  • Well a video could be generated by JavaScript on the fly but this is not really the way OP though of I guess. :) –  Jun 28 '11 at 11:56