最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Is possible automatic fullscreen with html5? - Stack Overflow

programmeradmin0浏览0评论

I'm based on 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.

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.

Share Improve this question edited Jul 19, 2012 at 19:40 richie-torres asked Jul 19, 2012 at 19:33 richie-torresrichie-torres 7561 gold badge9 silver badges29 bronze badges 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 Commented 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 Commented Jul 19, 2012 at 19:36
  • 1 It has also been answered on SO: stackoverflow.com/a/9747340/215042 – RobIII Commented Jul 19, 2012 at 19:44
  • Many more duplicates of this question are listed here. – Anderson Green Commented May 17, 2013 at 17:53
Add a comment  | 

2 Answers 2

Reset to default 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.

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.

发布评论

评论列表(0)

  1. 暂无评论