Can I make a full-screen HTML5 game?
I'm making an HTML5 game.
Is there anyway to prov开发者_StackOverflow社区ide the user with a button to make it full-screen? For any browsers.
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.
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/
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.
精彩评论