I've written a fairly simple kiosk app for a enterprise-enrolled/managed chromebox. I want to provide a default URL through a policy with chrome.storage.managed. According to the documentation available a schema could look something like this:
{
"type": "object",
"properties": {
"DefaultUrl": {
"title": "Default URL",
"description": "The Default URL that will be loaded",
"type": "string"
}
}
}
And then the configuration text file you upload on the admin.google page would look like this (but this is kind of a guess):
{
"DefaultUrl": {
"Value": "http://example.com"
}
}
Next I try to use this URL using the following code:
chrome.storage.managed.get('DefaultUrl', function (data) {
var url = data.DefaultUrl;
/*if(url == undefined)
url = "undefined url";*/
//further code to proces the url
});
As far as I understand from the documentation a dict object with key/value pairs is returned containing the specified keys (1 in my case). When I uncomment the if
statement in the above code the variable url
always ends up being "undefined url", and otherwise it doesn't show any text (since it seems to be undefined)..
Debugging this isn't easy, because as far as I know you can't use console.log in kiosk mode, the policies can't be set through the admin panel when running it locally and since it's a managed device I can't run it from dev mode..
Can anyone tell me what's wrong here? If this is insufficient info I'd be glad to supply more, but my guess is the error is somewhere in the code above.
Update
I got this working locally when adding policies for chrome in my windows register, as described by the 'windows' part on: this site.. Allthough I am now using more than 1 policy, so maybe the error was that the schema expects atleast 2 policies? I have yet to test this on the kiosk app.