Home Ask Login Register

Developers Planet

Your answer is one click away!

RPR February 2016

Chrome app , javascript issue

In the chrome app I have some js/files.js that are being loading in the index.html and others html.

I was using:

 "app": {
    "launch": {
      "local_path": "index.html",


but it is deprecated and going to be removed from webstore chrome this month.

I've changed as it recommend, with :

"app": { "background": { "scripts": ["main.js"] } },

and there it is calling the index.html when I've made this change , javascript did not work anymore. Can't figure it out what is happening. I've tried and read every kind of issue with chrome app and javascript files, but cant run a simple function like:

 var index = {
 initialize: function () {        
    setTimeout(function () {
        var user = null; 
        if (user == null) {
            window.location.href = "login.html";
        } else {
            //do something more
    }, 500);


from this js file


user2181397 February 2016

There is an unbalanced(extra) } in this snippet

"app": { "background": { "scripts": ["main.js"] } } },

Xan February 2016

You cannot manipulate window.location from App pages anymore, among other things.

Basically the idea is to have to use a single-page applications, or as a workaround you can open new windows with chrome.app.window as needed.

Post Status

Asked in February 2016
Viewed 2,991 times
Voted 13
Answered 2 times


Leave an answer

Quote of the day: live life