5

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 ifstatement 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.

Guinn
  • 1,355
  • 13
  • 29
  • Remote-debugging a Kiosk app is hard, but [possible](http://stackoverflow.com/questions/27444971/how-to-debug-a-kiosk-chrome-application-running-on-a-chromebox/27454778). – Xan Dec 10 '15 at 15:10
  • Note, JSON keys are case-sensitive, why did you "guess" that it would be `"Value"`? Edit: Nevermind, saw http://www.chromium.org/administrators/configuring-policy-for-extensions – Xan Dec 10 '15 at 15:11
  • Did you verify `chrome://policy`? – Xan Dec 10 '15 at 15:14
  • Well I did verify when running locally and the policy is created but unset, which is the expected behavior.. But I can't (or dont know how) to verify chrome://policy on the chromebox running in kiosk mode. The remote debugging isn't possible for a enterprise-enrolled device since you can't run in dev mode then – Guinn Dec 10 '15 at 15:17
  • Hi, Guinn, did you found a solution ? I'm facing the same issue. – Adrien QUINT Oct 10 '17 at 15:01
  • Hi @AdrienQUINT, the problem was picked up by a collegue, but it was resolved! It was a long time ago though, and I don't have access to the project anymore. So I can't check the solution. But google has continued updating it's documentation about this, so try looking through that again! – Guinn Oct 24 '17 at 14:31

0 Answers0