我发现有一些地方谈到尝试在屏幕之间扩展窗口,启用了统一的桌面标记,但这并不起作用。
我还发现有一些地方在Windows中使用Win32调用来做这件事,这对ChromeOS来说是无用的。
我只需要在第二个屏幕上放置第二个Web视图。它不需要是一个扩展窗口。我只需要这样做:
chrome.app.runtime.onLaunched.addListener(function() {
var screenOne = {
'id': 'mainwin',
'bounds': {
'width': 768,
'height': 1360
}
};
var screenTwo = {
'id': 'secondwin',
'bounds': {
'left':768+768,
'width': 768,
'height': 1360
}
};
chrome.power.requestKeepAwake("display");
chrome.app.window.create('../index.html', (screenOne));
chrome.app.window.create('../screen2/index.html', (screenTwo));
});
此外,在模拟器中运行的解决方案的奖励积分。
答案 0 :(得分:2)
这是我的解决方案,效果很好。它要求您将system.display
添加到manifest.json
chrome.app.runtime.onLaunched.addListener(function() {
var screenUrls = ['../index.html','../screen2/index.html'];
chrome.system.display.getInfo(function(displays){
for(var id in displays){
var display = {
id: displays[id].id,
bounds:displays[id].bounds
};
chrome.app.window.create(screenUrls[id], display);
}
});
chrome.power.requestKeepAwake("display");
});