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

后端 未结 6 905
悲&欢浪女
悲&欢浪女 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:39

    main.js

    chrome.app.runtime.onLaunched.addListener(function() {
      chrome.app.window.create('index.html',{},function(window) {
        window.fullscreen();
      });
    });
    

    manifest.json

    {
      ...
      "manifest_version": 2,
      "minimum_chrome_version": "23",
      "app": {
        "background": {
          "scripts": ["main.js"]
        }
      },
      "permissions": ["fullscreen"]
    }
    

提交回复
热议问题