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

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

    Now, you can just add the state:"fullscreen" property on your main .js:

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

    Make sure you don't add resizable: false or bounds properties, and you add a "fullscreen" permision on the manifest.json.

    {
        ...
        "permissions": [
            ...
            "fullscreen"
        ]
    }
    

提交回复
热议问题