How to set full width and height for chrome new window

强颜欢笑 提交于 2019-12-12 16:06:42

问题


How can I create new window with full of available space in display screen.

function CreateWindow () {
    chrome.app.window.create("Spreadsheet.html" , {
        "bounds"    :   {
            "width" :   500,          // need full width and height
            "height":   400 
        }
    });
}

chrome.app.runtime.onLaunched.addListener(CreateWindow);

回答1:


You cannot access window.innerWidth and height though you can use below code

function CreateWindow () {
    chrome.app.window.create("Spreadsheet.html" , {
        "bounds"    :   {
            "width" :   window.screen.availWidth,
            "height":   window.screen.availHeight   
        }       
    });
}

chrome.app.runtime.onLaunched.addListener(CreateWindow);



回答2:


Create the window maximized to use all available screen space.

chrome.app.window.create("Spreadsheet.html" , { state: 'maximized'}

See app window documentation for more details.



来源:https://stackoverflow.com/questions/18911379/how-to-set-full-width-and-height-for-chrome-new-window

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!