Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to tile 2 BrowserViews into one BrowserWindow, 1st not rendering #10323

Closed
rkpatel33 opened this issue Aug 22, 2017 · 4 comments
Closed

Comments

@rkpatel33
Copy link

I am running the code below to create two BrowserView's in a single BrowserWindow, one below the other. Each one works independently, however when I instantiate both and add them to the window on the second one remains.

With webview tags this is possible so not sure if this is expected behavior or a bug, seems like a bug.

  • Electron version: 1.7.5
  • Operating system: MacOS Sierra

Expected behavior

Expect both BrowswerViews to render as long as they are positioned properly (non-overlapping).

Actual behavior

Only the second windowed added shows up.

How to reproduce

main.js file:

const electron = require('electron');
const app = electron.app;
const BrowserWindow = electron.BrowserWindow;
const BrowserView = electron.BrowserView;
const { ipcMain } = require('electron');

const path = require('path');
const url = require('url');

require('electron-debug')({showDevTools: false});

let browserWindow;

function createWindow() {
    browserWindow = new BrowserWindow({ width: 1200, height: 1200 });

    let browserView1 = new BrowserView({
        webPreferences: {
            nodeIntegration: false
        }
    });

    let browserView2 = new BrowserView({
        webPreferences: {
            nodeIntegration: false
        }
    });

    browserWindow.setBrowserView(browserView1);
    browserWindow.setBrowserView(browserView2);

    browserView1.setBounds({ x: 0, y: 0, width: 1200, height: 600 });
    browserView2.setBounds({ x: 0, y: 600, width: 1200, height: 600 });

    browserView1.webContents.loadURL('https://electron.atom.io');
    browserView2.webContents.loadURL('https://www.google.com');

    browserWindow.on('closed', function () {
        browserWindow = null;
    });
}

app.on('ready', createWindow);

app.on('window-all-closed', function () {
    if (process.platform !== 'darwin') {
        app.quit();
    }
});

app.on('activate', function () {
    if (browserWindow === null) {
        createWindow();
    }
});
@enlight
Copy link
Contributor

enlight commented Aug 22, 2017

The current API only allows for one BrowserView per BrowserWindow, multi-view support will hopefully be implemented later.

@jacklovepdf
Copy link

feel sad!

@dingchaoyan1983
Copy link

when this feature will be implemented

@buffet-time
Copy link
Contributor

buffet-time commented Feb 11, 2019

#16148

First seen in Electron v5.0.0-beta.1

@dingchaoyan1983

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants
@enlight @rkpatel33 @dingchaoyan1983 @buffet-time @jacklovepdf and others