Search code examples
node.jsangularelectronmicrosoft-teamsmicrosoft-graph-teams

Displaying Teams web app in my electron app


So I am working on an electron app and I want to display MS Teams web app in it. I already managed to display MS Word, MS Powerpoint, and some other apps I want to display. Every app is working except MS Teams. I am using "window.loadURL('')" for all of them and all work except Teams. I have disabled nodeIntegration and enabled contextIsolation.

When I run the app and try to open Teams in the console there are 2 errors I can't resolve and I tried a lot of stuff to make it work.

Error Messages

enter image description here

Tell me if this is even possible I am not very experienced with electron...


Solution

  • Adding the latest chrome user agent to BrowserView helped. Before loading Teams in the BrowserView for Teams, you can add the latest chrome user agent to it.

    const userAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36';
    let view;
    view = new BrowserView();
    view.webContents.setUserAgent(userAgent);
    view.wevContents.loadURL('https://teams.microsoft.com');
    

    This is for Chrome 87 however if you try to set the user agent to just 'Chrome' you will get an error like "your browser version is too old".

    The same goes for electrons BrowserWindow.

    And yeah, it can be a solution. But I don't recommend using it. As Google is planning on making a lot of changes to the user agent and eventually removing it. More about it you can read here:

    And yeah, maybe you could use it but we can't know how even slight changes from Google will affect your electron app.