如何为Chrome新窗口设置全宽和全高 [英] How to set full width and height for chrome new window

查看:177
本文介绍了如何为Chrome新窗口设置全宽和全高的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在显示屏幕中创建具有可用空间的新窗口.

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);

推荐答案

尽管可以使用以下代码,但您无法访问window.innerWidth和height

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);

这篇关于如何为Chrome新窗口设置全宽和全高的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆