browserWindow.loadUrl for external URL launching in external browser


#1

Hi All,

I’m pretty new to Electron but making good progress. However, I’ve hit a snag I can’t seem to google my way out of. I am attempting to hook my electron app up to Box via box api’s. The first part is OAuth. I’ve set up a secondary browser window which attempts to load the inital Box Oauth URL. however, when I run the app and the auth browser window opens, the URL instead pops open in Chrome and the electron browserwindow remains empty.

It seems to be something with the fact that the URL is not local. If I change the URL to a local file:// it works just fine. If I point it at anything else, it launches the URL in the external browser (Chrome for me).

Here’s my sample code so far. Any ideas?

   authUrl = "http://www.google.com";
   var winOptions = { width: 600,
                      height: 800,
                      show: false,
                      nodeIntegration: false,
                      webPreferences: {
                          webSecurity: false
                      }
                  };
   var authWindow = new BrowserWindow(winOptions);
   authWindow.loadURL(authUrl);
    authWindow.show();

Thanks,

Greg


#2

I solved my own problem (mostly because I finally had an ‘ah hah’ moment that I created the problem). I am intercepting the http/https protocols in another part of the client so they can be redirected to the external browser.

Took me a while to make the association that the protocol interceptor was also dutifully intercepting and redirecting my attempts to loadURL the Box API.

Self-inflicted. Doh!