0
Chrome应用程序有一个我想模拟的功能。本质上,manifest.json调用一个脚本(main.js),该脚本使窗口打开并以某种方式调整html的大小。不支持背景manifest.json
因此,不要直接加载html,而应该预先加载并执行此脚本,以便应用程序感觉更加完整和封装。现在,当我加载应用程序(测试它)时,我没有任何问题。但是当我去上传时,我收到一个错误。
现在,因为我知道这个清单和脚本的工作sideloaded和在这个其他上传的应用程序,我不知道我应该能够得到它没有错误上传。
An error occurred: Failed to process your item. background subsection of app section is not supported.
这是得到的错误清单的一部分:
"app": {
"background": {
"scripts": [ "main.js" ]
} },
有没有办法让这个脚本工作,或通过其他方式得到的效果吧?
这里是main.js脚本:
/**
* Listens for the app launching then creates the window
*
* @see http://developer.chrome.com/trunk/apps/app.runtime.html
* @see http://developer.chrome.com/trunk/apps/app.window.html
*/
chrome.app.runtime.onLaunched.addListener(function() {
// Center window on screen.
var screenWidth = screen.availWidth;
var screenHeight = screen.availHeight;
var width = 1280;
var height = 720;
chrome.app.window.create('index.html', {
bounds: {
width: width,
height: height,
left: Math.round((screenWidth-width)/2),
top: Math.round((screenHeight-height)/2)
}
});
});