1

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.

bobwirka
  • 324
  • 1
  • 6
  • 10

1 Answers1

0

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.

Hans Koch
  • 4,283
  • 22
  • 33
  • I should clarify; yes, we always need JavaScript client side. I just want the client side browser to be independent of the server side; like vanilla Chrome or Firefox, only able to be opened to an arbitrary size. Can't figure that out. – bobwirka Oct 23 '17 at 13:06
  • You could open chrome with arguments to specify the size and position https://stackoverflow.com/questions/13436855/launch-google-chrome-from-the-command-line-with-specific-window-coordinates But tbh I would still use electron over that since it is an independent process over chrome and does the exact same. It literally does open up a chromium process. – Hans Koch Oct 23 '17 at 13:46
  • 1
    Hans, thanks for your comments. Seems I've stumbled upon a solution (see my update). – bobwirka Oct 23 '17 at 14:34