Search code examples
google-chrome-app

Can't reload the opened page in a Chrome App


I'm trying to update a page in a Chrome App but I get the error:

Can't open same-window link to "chrome-extension://XXXX/page.html"; try target="_blank".

My manifest.json:

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

my background.js:

chrome.app.runtime.onLaunched.addListener(function() {
  chrome.app.window.create('page.html', {
    'outerBounds': {
      'width': 7000,
      'height': 7000
    }
  });
});

and a window.location.reload(); in page.js

P.S.: I considered chrome.runtime.reload();, but it will restart the window/browser, I just wanted to refresh the page without the window closing and opening.


Solution

  • I've created another page "main.html" and I'm loading the "page.html" from that one on an iframe and I'm able to reload it that way,

    Just posting my own solution in hope that it might help someone.