using chrome.windows.create() to launch a window in PWA mode - google-chrome-extension

I'd like to use my chrome extension to create and manage the focus for windows in my Progressive Web App. Focusing windows works well, but whenever I try to create a new window using chrome.windows.create(), the url loads into a new web browser window and not within the PWA. Is there a way to get chrome to recognize that a url within that scope should always load within the PWA?
My app requires allowing the user to micromanage their window focus to keep their workflow fast, and unfortunately vanilla .open() and .focus() have loads of limitations within chrome.

Related

Browser control from Tarui main process

Is there a way to granularly control the Browser Process within the front-end WebView from the Tauri Core Process?
Why?
Because I want to put together a Tauri application with the ability to automate browser window operations on specific websites without worrying about CORS or page transitions.
Like using puppeteer-in-electron with Electron:
Page navigation
Rewrite part of the DOM
Clicking buttons
Get the value of a specific element
WebDriver, which requires a driver binary that matches the OS renderer version, is not suitable for my use.
Use Electron? That's right.
I'm attracted to Tauri because of its small app bundle size and automatic security updates for the web renderer.

How to change the content and size of the app window that installs the extension

I created a Safari Web Extension using the script that generates the project from a Chrome extension.
My users are confused by the process of buying the app and then running it which just opens a window that does nothing (they keep asking for refunds saying the app doesn't work). So I want to add some more text into the app window that tells them they have to look for the extension in Safari.
I can see how to add the text in the html file called "Main". But in my Mac app this means that the content no longer fits within the apps window. I'm trying to figure out how to change the size of the app window.
Also, the script generates a Mac app with a help menu but it just says that help is not available. How do I go about adding some help to explain that this App does nothing and that the extension is in Safari?
It seems like the script does a lot of the work for you but you still have to learn a bit about developing an App (rather than an extension) to make it a polished experience.

How to open new browser instance with specified size and position

From the command line, or from an application, I want to open a NEW browser instance with a specified size and position, and pointed to a specific URL. I want to open a browser that acts like a dialog box. Ideally, I'd like to be able to disable "decorations" (like tabs, bookmarks, etc.). I do not want to open a new tab or pop-up window from an existing browser instance.
I know Electron or Node Webkit do this, but I just want to open a browser as that acts as a GUI front end for whatever back end I'm building.
I'd be happy if it would work for a specific browser; say, Chrome, or Chromium.
So, for instance, a Python app (or C/C++, Java, etc.) could start it's web server, then open a browser of the proper size, pointed to "localhost:xxxx/whatever.html", and serve up data via AJAX.
Kind of a universal single page app front end...
UPDATE (SOLUTION?)
The answer seems to be in two parts: 1) Opening the browser with command line switches, and 2) Resizing the window in JavaScript.
Using chromium (or Chrome), on the command line:
chromium-browser --new-window --app=http://192.168.1.80:8080/index.html
Then, within your JavaScript:
window.resizeTo(800,500)
This will bring up a new window and resize it.
This is great. Now, I can make an app in any language that allows me to open a web server. The user interface is done in HTML, CSS, and JavaScript. The browser is opened from within the application using the proper command line switches.
Electron does simply open up one or multiple browser windows, you can set them to any url via BrowserWindow.loadURL(url) this could be https://google.com https://localhost:1337 (Your backend webserver) or a local HTML file. The BrowserWindow can be created with information such as size and position.
The only alternative would be something like Qt HTML5 applications that use Qt WebEngine, but this does basically the same thing since Electron and Qt WebEngine use chromium.
Also, there is no point in a single page app that runs without JavaScript.

Is it possible to access DOM elements of a chrome app from another chrome app / extension?

This is something like a chrome extension changes the elements of a web page dynamically.
I am wondering if i can change the DOM elements of a chrome app from another chrome app or extension.
If this is possible, how can I do that ?
========================================================
Example:
There is a standalone chrome app working on the desktop
There is another app / extension works like a chrome app debugging tool which can access the content of that standalone app
The answer can be no, since when you are saying the DOM elements of a chrome extension, I guess you mean the popup/options page for the extension, its url starts with chrome://extensions while content script can't access this kind of page.
The answer can also be yes, since if you have control on both of the extension, you can do Cross-extension messaging, in this way, to some degree you can achieve change the DOM of a chrome extension from another extension.

How to prevent a Chrome App from being closed?

I am building my first local Chrome App using this tutorial
My goal is to build an app that launches fullscreen when the PC is started.
The app can be closed by pressing a certain button (Q) but otherwise the user should not be able to close the app.
Is this possible using Google Chrome Apps? How do you launch fullscreen, and how do you prevent the user from closing the app?
Can you prevent the user right-clicking to inspect the page, or clicking on the top menu bar to close the app?
Sounds like you may want to use kiosk mode. Use this manifest permission for your app, as listed here.
You can enter kiosk mode from the chrome command line as well, with --kiosk.

Resources