问题
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