7

I'm based on Using the Fullscreen API in web browsers (http://hacks.mozilla.org/2012/01/using-the-fullscreen-api-in-web-browsers ) for fullscreen , but only works with a click event or with console firebug, not with submit event or mouseover or similar for made automatic. Is possible automatic fullscreen with html5 without click event or similar ?

Edit: I understand the security and accessibility reasons if not possible, but in some environments this can be hopeful.

4
  • We had that in 1998 when popups created windows bigger than the screen. It would be really nice if browsers couldn't do that unless there was intentional human input desiring that.
    – vcsjones
    Jul 19, 2012 at 19:36
  • 3
    How about reading the comment explaining it? "fullscreen requests are only granted in user generated event handlers (mouse click and key press handlers). This way the user can be in control of when the site enters fullscreen, also to help guard against phishing attacks."
    – RobIII
    Jul 19, 2012 at 19:36
  • 1
    It has also been answered on SO: stackoverflow.com/a/9747340/215042
    – RobIII
    Jul 19, 2012 at 19:44
  • Many more duplicates of this question are listed here. May 17, 2013 at 17:53

2 Answers 2

16

No, it's not possible - for security reasons accessing full screen requires the user's "permission", and so is tied to browser input events.

1
  • 4
    It's the same mechanism that prevents pop-up windows from opening; the user must click a button to open a pop-up window, or the pop-up blocker will block it. Facebook, however, has a neat little solution to this when uploading videos (in Chrome): it displays a box on screen that says, "Facebook needs to open a new window to upload your video," with an OK button, which opens the new window when clicked. You can implement a similar solution by displaying a message that says, "We need to go full-screen to continue," and an OK button that puts the page in full-screen and removes the message.
    – wecsam
    Jul 19, 2012 at 19:45
2

No, that is not possible. The requestFullScreen() must be triggered by a direct user action (like a click) for security considerations. It's just the same as with popups.

Read https://wiki.mozilla.org/Security/Reviews/Firefox10/CodeEditor/FullScreenAPI and maybe https://wiki.mozilla.org/Gecko:FullScreenAPI for reference.

1
  • I've had problems even entering fullscreen from a callback (from a callback from a callback from a ... etc) called from an event handler. Tricky!
    – Luke H
    Apr 14, 2014 at 18:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.