How can I make a chrome packaged app which runs in fullscreen at startup?

后端 未结 6 891
悲&欢浪女
悲&欢浪女 2021-02-14 06:39

Currently it seems that the fullscreen ability can only be activated from a user action (mouse/keyboard event). Is there a way to circumvent this?

6条回答
  •  情书的邮戳
    2021-02-14 07:25

    Check out https://plus.google.com/100132233764003563318/posts/2SuD7MVd8mG referring to recently landed changelist https://chromiumcodereview.appspot.com/12205002. You can lift sample code from either of those sources:

    document.body.addEventListener('click', function() {
      document.body.webkitRequestFullscreen();
    });
    

    Make sure in your manifest you're requesting the "fullscreen" permission and that you're testing on a sufficiently recent Chrome build (beta channel ought to have this feature by now, and dev definitely does).

    Your question specifically refers to packaged apps, but in case anyone reading this answer missed this, this will work only with Chrome packaged apps.

提交回复
热议问题