I want to create chrome web app that will open in own window like Google Keep extension for chrome.
I made chrome web store package, but how to open it in self window instead of chrome browser ??
Create a packaged app by
Using a manifest with { 'app': { 'background': '...' } ....
Add a chrome.app.runtime.onLaunched listener that calls chrome.app.window.create
See the hello-world sample.
Related
I have a PWA that is able to open secondary windows, when I open them using window.open the new windows have the same window style of the main PWA (no Chrome UI, no tabs, no address bar, status bar of the color defined by my app), the new window will also be grouped under the PWA icon in the operative system Dock/taskbar.
The look of the windows is just like the image below:
I also have a Chrome extension that must be able to open such windows, but the problem I'm having is that if I use chrome.windows.create with popup type the resulting windows have the normal Chrome status bar color, and they aren't listed under the PWA icon. Like this:
I'd like to understand if there's any way to open a window from a Chrome extension and have it follow the PWA-defined theme and get listed under the PWA dock/taskbar icon?
To launch an installed PWA use chrome.management API in an extension page or background script:
chrome.management.getAll(apps => {
const pwa = apps.find(a => a.appLaunchUrl === 'https://pwa.foo.bar/');
if (pwa) chrome.management.launchApp(pwa.id);
});
If you want to set the launch type:
chrome.management.getAll(apps => {
for (const a of apps) {
if (a.appLaunchUrl === 'https://pwa.foo.bar/') {
chrome.management.setLaunchType(a.id, 'OPEN_AS_WINDOW', () => {
chrome.management.launchApp(a.id);
});
break;
}
}
});
manifest.json:
{
"permissions": ["management"],
My electron desktop app loads an angular app into a browser window. That angular app has a button that should open a new website (lets say google.com as an example). When I use the following code...
<button (click)="openNew()">Open a new window</button>
openNew() {
window.open('www.google.com')
}
the app opens a new electron browser window. I want the window to open in a native browser window (chrome, firefox, internet explorer, etc). Can this be possible within an electron app?
Based on documentation, you can open links on OS default browser with code below
const { shell } = require('electron')
shell.openExternal('https://github.com')
Read for further information:
https://www.electronjs.org/docs/api/shell#shellopenexternalurl-options
Is it possible to have a webview application for a web page and load extensions in the application?
I have created a frameless wrapper for one of our web pages, so we can hide the chrome header. I am also using the stylebot extension to alter some elements in the page. It works fine inside chrome, but when I run the application the stylebot extension is not loaded.
Any idea how can I add the extension to the application?
Greatly appreciate your help on this
Thanks, Laszlo
A Google chrome extension have to be load in Google Chrome (or Chromium based browsers). The Google chrome extension API is not included in the webview engine.
You can open a frameless window with create method of the Google window API. You should add an handler to browser action click and create a window of with "popup" type and the url you want. It's not exactly what you are looking for but I don't know a better way to do it on Mac. Perhaps some one more familliar with that environement could help you.
An other far more complicated solution is to fork the Crhomium project and do what you want. But it demand a large developpement I think.
So I know that 'Chrome Packaged App' will run in a window, I have tried to run the website I want in a <webiview> tag but it gets stuck at the beginning and I can't find a way to debug what's happenning inside that <webview> tag.
I now have tried to change the manifest to work as a 'Chrome Hosted App' but it keeps opening in a tab.
How do I start my app in a window, either by having it as a chrome hosted app?
Or by <webview> (if I find a way to debug it)?
As pointed here, a Chrome Hosted app can be open in a specific window if you enable this flag:
Enables the web app style frame for hosted apps
in chrome://flags.
Chrome's built-in developer tools can be used to debug packaged apps, extensions and webview as well as web pages (Right-click on any page element in webview and select Inspect Element).
I have a standalone frame-less Chrome app. I'm sending messages from another Chrome extension to it (Chrome app) which works. But I would like to be able (if it's possible) to launch the app using the extension. Because now I have to launch the app manually.
I've seen Google music "mini player" that you can launch from music.google.com. So I'm wondering if the same can be done using chrome extension.
I wouldn't need the Chrome extension if the Chrome app could read opened tabs or just URLs but since this is not possible one must use extension and message to app to achieve this.
just send msg to your app from extension when you want to open it (In my case, I'm opening app when injected element on page is clicked)
extension script:
var appID = "qwertzuiopasdghghjkhgjghj";
element.onclick = function () {
chrome.runtime.sendMessage(appID, {message: 'fireup'}, function(response){});
});
app background script:
chrome.runtime.onMessageExternal.addListener(function(request, sender, sendResponse) {
if (request.message == 'fireup') {
chrome.app.window.create("page.html",
{
//whatever
});
}
});
You can use chrome.management.launchApp method: https://developer.chrome.com/extensions/management#method-launchApp
To use it you need to add "management" permission to your extension manifest file