Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open a Chrome app within a tab

This issue started with version 23 of Google Chrome. My Chrome app opens a tab to display its UI when the launched event fires.

chrome.app.runtime.onLaunched.addListener(function() 
{
   chrome.tabs.create(
   {
      url: "../../index.html"
   });
});

This scheme was working previous to version 23 of Google Chrome. Now receiving the following exception when running my app.

Error in event handler for 'app.runtime.onLaunched': Cannot call method 'create' of undefined TypeError: Cannot call method 'create' of undefined

After checking the chrome object in developer tools I notice that chrome.tabs is undefined.

I know that I dont have to explicitly set a "tabs" permission in my manifest.json because according to http://developer.chrome.com/extensions/tabs.html the create, update, and remove methods dont require the "tabs" permission.

After trying to explicitly add the "tabs" permission to the manifest.json file I then receive this message on chrome://chrome/extensions/ for the app.

There were warnings when trying to install this extension: 'tabs' is only allowed for extensions and legacy packaged apps, and this is a packaged app.

If I am going by the chart given by https://developers.google.com/chrome/web-store/docs/choosing and have chosen a packaged app because my app's UI is not small and I dont intend on extending Chrome's UI and I cannot make use of chrome.tabs then how can I open my app's UI inside of a new or existing tab without having to create a popup window (which is very annoying and not user friendly)?

like image 569
cs_brandt Avatar asked Oct 29 '12 03:10

cs_brandt


People also ask

How do I add Apps to my Chrome tab?

Open the Chrome Web Store. In the left column, click Apps or Extensions. Browse or search for what you'd like to add. When you find an app or extension you'd like to add, click Add to Chrome.

How do I split a tab in Chrome screen?

See two windows at the same timeOn one of the windows you want to see, click and hold Maximize . Drag to the left or right arrow . Repeat for a second window.

How do I run two Apps in Chrome?

First, open Chrome and pull up at least two tabs. Long-press the Android overview button to open the split-screen app selector. Then, open the Chrome overflow menu in the top half of the screen and tap "Move to other window." This moves your current Chrome tab into the bottom half of the screen.


1 Answers

Have you tried window.open() in chrome.app.runtime.onLaunched

like image 144
Sudarshan Avatar answered Oct 27 '22 01:10

Sudarshan