Search code examples
javascriptgoogle-chrome-appkiosk-modegoogle-chrome-os

Kiosk chrome app: navigate to URL


I have built a Chrome App which needs to load some websites inside its own window.

The purpose is to display full-screen contents on TVs using Google Chromeboxes in Kiosk mode.

I can't use iframes as the content I must load doesn't allow it.

My researches led me to some code like :

chrome.browserAction.onClicked.addListener(function(tab) {
    chrome.tabs.create({'url': event.target.href})
})

This seems to open a new tab on the browser running the extension, but not in the extension window.

The vision I have about chrome apps may be confused as it's the first I'm developing, please don't hesitate to tell me the basics I would not have heard of


Solution

  • You need to use the <webview> tag, available in Chrome Apps, to embed external content.

    This does not trigger anti-framing protection, since from the point of view of web security each <webview> is a top-level browsing context.

    Note the limitations of <webview>: some web features like message boxes or permission requests have to be implemented by you.

    As an example of webview usage, see the Browser sample app.