Best practices for wrapping a website


#1

I’m looking to wrap a website into an electron app. It’s a single page application built using AngularJS.

From what I’m reading, I could:

Option 1 - Load the site directly in BrowserWindow, e.g. BrowserWindow.loadUrl('http://mysite');
Option 2 - Load the site in a <webview> control that fills the BrowserWindow 100% h/w.

What’s the recommended option?
Best practices?
Any gotchas I should know about?

Pointers to a sample / bootstrap / boilerplate would be very helpful. All the boilerplates I’ve found assume it’s a local web app, not wrapping a web site.


#2

Personally I would go with Option 1.

This sort of depends on why you want to wrap this website in an electron app. If the website itself will utilize electron functionality, Option 1 will make it easier through ipcMain <-> ipcRenderer communication. Option 2 will force you to go through ipcRenderer/webview <-> ipcRenderer communication which is less fleshed out and more restricting.

However if security is a large concern, as in you’d perhaps deal with 3rd party developed pages and the like, Option 2 might be more appropriate as webviews wrap the page in a separate process with reduced permissions.