Hello,
I am developing my first app, to be used offline as packaged app. So far I have four files: manifest.json, a HTML page, a JS script file and CSS file.
My first problem is the start up. The HTML page contains <script type="text/javascript" src="main.js" ></script> and <body onLoad="initOnLoad();"> , so when loaded offline as file:// URL javascript function initOnLoad() does what it is supposed to do - populate some additional HTML content based on data included in main.js.
When I try to load my work in progress as unpacked app, it does not start properly. I tried to include some "background" stuff in the manifest, but the best result was opening the uninitialized page (all content generated by initOnLoad() was missing). I did this by including this in the manifest:
"app" { "launch": { "localpath": "my-page.html" } },
However, Chrome security model will not allow the inline javascript code to be started, so that is why it does not work. I also tried, following tutorials, to create background.js file containing call to addListener:
chrome.experimental.app.onLaunched.addListener(function() {
chrome.windows.create({
url: 'qsoinput.html',
type: 'shell',
width: 600,
height: 450
});
});
and I also added "background": { "scripts": ["background.js"] }, "permissions" : ["experimental"], to the manifest and reloaded the app. I am puzzled that it generates one more HTML page from this code, but nevertheless it still does not start. I also activated some experimental functions to let background tasks and other stuff run in my installation of Chrome, using chrome://flags.
I would like to ask someone to help me with this. Developer mode in Chrome does not show enough information, especially it does not show whether the background.js code is running and if there were any exceptions. My general impression is that Chrome, in app mode, does not start any javascript code and hence the whole package appears dead.
My Chrome version is 20.0.1132.57 Windows 64 bit;
my chrome://flags :
- Applications without CRX file - activated
- Allow experimental extension API - activated
- Allow experimantal javascript - activated
- Allow shadow DOM - activated (although it is not clear for me what this is supposed to do, there's only vague description)
- Allow platform applications - activated (but this one should not have effect on my app)
Anybody could help? Pointer to a tutorial that makes sense and does what the author says it should do? Google original tutorials either do not work with this version of Chrome, or they are not written for packaged apps. When I try to imitate some of the tutorial manifests, I get what I described above.
Thank you,
Jindra